11 개 언어, 536 바이트
Bash-> Python 3-> Go-> Lua-> Rust-> Java-> C99-> Python 2-> JavaScript-> Ruby-> Batch
세게 때리다:
e="echo -n "
p(){
eval "for i in {1..$1}
do
$e'\'
done"
}
$e'import sys;print("package main\nimport \"fmt\"\nfunc main() {fmt.Printf(\"if 1 == 1 then print(\\\"fn main() {let s='
p 7
$e'"public class Main{public static void main(String[] args){System.out.println('
p 15
$e'"#include <stdio.h>'
p 16
$e'nint main() {printf('
p 31
$e'"print '
p 63
$e"\"alert('puts "
p 128
$e"'@echo PPCG"
p 128
$e"'');"
p 63
$e'"'
p 31
$e'");}'
p 15
$e'");}}\\\\\\\";println!(\\\\\\\"{}\\\\\\\", s);}\\\") end\")}") if sys.version_info[0]==3 else exit()'
이 p
함수는 모든 백 슬래시를 수동으로 입력하는 것과 비교하여 코드 크기를 497 바이트 줄입니다.
파이썬 3 :
import sys;print("package main\nimport \"fmt\"\nfunc main() {fmt.Printf(\"if 1 == 1 then print(\\\"fn main() {let s=\\\\\\\"public class Main{public static void main(String[] args){System.out.println(\\\\\\\\\\\\\\\"#include <stdio.h>\\\\\\\\\\\\\\\\nint main() {printf(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"print \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"alert('puts \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'@echo PPCG\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'');\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");}\\\\\\\\\\\\\\\");}}\\\\\\\";println!(\\\\\\\"{}\\\\\\\", s);}\\\") end\")}") if sys.version_info[0]==3 else exit()
필수 파이썬 2/3 차별화.
가다:
package main
import "fmt"
func main() {fmt.Printf("if 1 == 1 then print(\"fn main() {let s=\\\"public class Main{public static void main(String[] args){System.out.println(\\\\\\\"#include <stdio.h>\\\\\\\\nint main() {printf(\\\\\\\\\\\\\\\"print \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"alert('puts \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'@echo PPCG\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'');\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\");}\\\\\\\");}}\\\";println!(\\\"{}\\\", s);}\") end")}
루아 :
if 1 == 1 then print("fn main() {let s=\"public class Main{public static void main(String[] args){System.out.println(\\\"#include <stdio.h>\\\\nint main() {printf(\\\\\\\"print \\\\\\\\\\\\\\\"alert('puts \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'@echo PPCG\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'');\\\\\\\\\\\\\\\"\\\\\\\");}\\\");}}\";println!(\"{}\", s);}") end
를 사용 if 1 == 1 then
하면 Python 호환성이 방지됩니다.
녹:
fn main() {let s="public class Main{public static void main(String[] args){System.out.println(\"#include <stdio.h>\\nint main() {printf(\\\"print \\\\\\\"alert('puts \\\\\\\\\\\\\\\\'@echo PPCG\\\\\\\\\\\\\\\\'');\\\\\\\"\\\");}\");}}";println!("{}", s);}
자바:
public class Main{public static void main(String[] args){System.out.println("#include <stdio.h>\nint main() {printf(\"print \\\"alert('puts \\\\\\\\'@echo PPCG\\\\\\\\'');\\\"\");}");}}
C99 :
#include <stdio.h>
int main() {printf("print \"alert('puts \\\\'@echo PPCG\\\\'');\"");}
파이썬 2 :
print "alert('puts \\'@echo PPCG\\'');"
자바 스크립트 :
alert('puts \'@echo PPCG\'');
루비:
puts '@echo PPCG'
일괄:
@echo PPCG