火龙信奥
  • 首页
  • 课程
  • 题库
  • 打卡
    • 代码对战
    • 快速对战
  • 题单
  • 团队
  • 荣誉墙
  • 商城
  • 登录 / 注册

编译器 & 例题

作者: 作者的头像   huolong , 时间:2023-09-18 16:08:22 , 所有人可见, 阅读  2

C ( GCC 9.4.0 ) 编译器

/usr/bin/gcc -DONLINE_JUDGE -w -fmax-errors=3 -std=c11 {src_path} -lm -o {exe_path}

A+B 题目

#include <stdio.h>
int main() {
    int a,b;
    scanf("%d %d",&a,&b);
    printf("%d",a+b);
    return 0;
}

C With O2 ( GCC 9.4.0 ) 编译器

/usr/bin/gcc -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c11 {src_path} -lm -o {exe_path}

A+B 题目

#include <stdio.h>
int main() {
    int a,b;
    scanf("%d %d",&a,&b);
    printf("%d",a+b);
    return 0;
}

C++ ( G++ 9.4.0 ) 编译器

/usr/bin/g++ -DONLINE_JUDGE -w -fmax-errors=3 -std=c++14 {src_path} -lm -o {exe_path}

A+B 题目

#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    cout << a + b;
    return 0;
}

C++ With O2 ( G++ 9.4.0 )

编译器

/usr/bin/g++ -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c++14 {src_path} -lm -o {exe_path}

A+B 题目

#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    cout << a + b;
    return 0;
}

C++ 17 ( G++ 9.4.0 ) 编译器

/usr/bin/g++ -DONLINE_JUDGE -w -fmax-errors=1 -std=c++17 {src_path} -lm -o {exe_path}

A+B 题目

#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    cout << a + b;
    return 0;
}

C++ 17 With O2 ( G++ 9.4.0 ) 编译器

/usr/bin/g++ -DONLINE_JUDGE -O2 -w -fmax-errors=1 -std=c++17 {src_path} -lm -o {exe_path}

A+B 题目

#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    cout << a + b;
    return 0;
}

C++ 20 ( G++ 9.4.0 ) 编译器

/usr/bin/g++ -DONLINE_JUDGE -w -fmax-errors=1 -std=c++20 {src_path} -lm -o {exe_path}

A+B 题目

#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    cout << a + b;
    return 0;
}

C++ 20 With O2 ( G++ 9.4.0 ) 编译器

/usr/bin/g++ -DONLINE_JUDGE -O2 -w -fmax-errors=1 -std=c++20 {src_path} -lm -o {exe_path}

A+B 题目

#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    cout << a + b;
    return 0;
}

Java ( OpenJDK 1.8 ) 编译器

/usr/bin/javac {src_path} -d {exe_dir} -encoding UTF8

A+B 题目

import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int a=in.nextInt();
        int b=in.nextInt();
        System.out.println((a+b));
    }
}

Python3 ( Python 3.7.5 ) 编译器

/usr/bin/python3 -m py_compile {src_path}

A+B 题目

a, b = map(int, input().split())
print(a + b)

Python2 ( Python 2.7.17 ) 编译器

/usr/bin/python -m py_compile {src_path}

A+B 题目

a, b = map(int, raw_input().split())
print a+b

Golang ( Golang 1.19 ) 编译器

/usr/bin/go build -o {exe_path} {src_path}

A+B 题目

package main
import "fmt"

func main(){
    var x int
    var y int
    fmt.Scanln(&x,&y)
    fmt.Printf("%d",x+y)  
}

C# ( C# Mono 4.6.2 ) 编译器

/usr/bin/mcs -optimize+ -out:{exe_path} {src_path}

A+B 题目

using System;
using System.Linq;

class Program {
    public static void Main(string[] args) {
        Console.WriteLine(Console.ReadLine().Split().Select(int.Parse).Sum());
    }
}

PHP ( PHP 7.2.24 ) 编译器

/usr/bin/php {src_path}

A+B 题目

<?=array_sum(fscanf(STDIN, "%d %d"));

PyPy2 ( PyPy 2.7.18 (7.3.8) ) 编译器

/usr/bin/pypy -m py_compile {src_path}

A+B 题目

print sum(int(x) for x in raw_input().split(' '))

PyPy3 ( PyPy 3.9.17 (7.3.12) ) 编译器

/usr/bin/pypy3 -m py_compile {src_path}

A+B 题目

print(sum(int(x) for x in input().split(' ')))

JavaScript Node ( Node.js 14.19.0 ) 编译器

/usr/bin/node {src_path}

A+B 题目

var readline = require('readline');
const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
});
rl.on('line', function(line){
   var tokens = line.split(' ');
    console.log(parseInt(tokens[0]) + parseInt(tokens[1]));
});

JavaScript V8 ( JavaScript V8 8.4.109 ) 编译器

/usr/bin/jsv8/d8 {src_path}

A+B 题目

const [a, b] = readline().split(' ').map(n => parseInt(n, 10));
print((a + b).toString());

Ruby ( Ruby 2.5.1 ) 编译器

/usr/bin/ruby {src_path} A+B 题目

a, b = gets.split.map(&:to_i)
puts(a + b)

Rust ( Rust 1.65.0 ) 编译器

/usr/bin/rustc -O -o {exe_path} {src_path}

A+B 题目

use std::io;

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).expect("stdin");

    let sum: i32 = line.split_whitespace()
                       .map(|x| x.parse::<i32>().expect("integer"))
                       .sum(); 
    println!("{}", sum);
}

—— 本文来自火龙信奥(义乌睿码科技):义乌青少年信息学奥赛与编程教育平台,专注 CSP-J/S、NOIP、GESP 竞赛培训,线上线下融合教学,助力编程升学。网址:hlcoding.com

©2026加盟我们 | 关于我们 | ACM课程 | 常见问题 | 成果墙 | 评测记录 | 浙ICP备2021013995号
在线画图 | OI WIki | 打字练习
火龙信奥
请输入登录信息


请完成安全验证
验证码底图 滑块
向右拖动滑块完成验证
请输入用户名 / 绑定的手机号码



请输入注册信息(手机号验证码注册)





验证码5分钟有效,60秒内不可重复获取,每日最多3次

微信登录

微信登录二维码

正在生成二维码...

账号已过期,请续期。
去续期

绑定手机号

📱

为了更好地保护您的账号安全,享受完整的平台服务

请您尽快绑定手机号码