A+B Problem 到底有多少种做法?
  • 板块灌水区
  • 楼主yxszcxl
  • 当前回复11
  • 已保存回复12
  • 发布时间2024/9/16 22:18
  • 上次更新2024/9/17 10:21:58
查看原帖
A+B Problem 到底有多少种做法?
1319065
yxszcxl楼主2024/9/16 22:18

1.最短代码

#include <iostream>
int main() {
	int a,b;
	std::cin>>a>>b;
	std::cout<<a+b;
}

别学我不return 0; 2.正常

#include <iostream>
using namespace std;
int main() {
	//ios::sync_with_stdio(false);
	int a,b;
	cin>>a>>b;
	cout<<a+b<<endl;
	return 0;
}

3.C#来一个!

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

4.函数

#include <bits/stdc++.h>
using namespace std;

int jia(int a, int b) {
	return a + b;
}

int main() {
	int a, b;
	cin >> a >> b;
	cout << jia(a, b);
	return 0;
}

5.油饼

#include <bits/stdc++.h>
using namespace std;
int a, b, ans;
void input();
void doit();
void output();

int main() {
	input();
	doit();
	output();
	return 0;
}

void input() {
	cin >> a >> b;
}

void doit() {
	ans = a + b;
}

void output() {
	cout << ans;
}

大家有新思路也可以评论区告诉我!

2024/9/16 22:18
加载中...