- A+B Problem
- @ 2016-09-03 15:59:34
大家估计认为代码会是这样的
c++
#include <iostream>
using namespace std;
int main()
{
int a,b;
cin >> a >> b;
cout << a + b << endl;
return 0;
}
我是很清纯的一个人,本来真以为是这样子的,看了一下难度就惊呆了……
难度⑨,不可能这么简单
用了九牛二虎之力,我才发现,这道题目需要用类定义
代码如下:
c++
#include <iostream>
using namespace std;
class A
{
public :
inline void func(int,int);
inline void print();
private :
int i,j;
};
int main()
{
A a;
int q,w;
cin >> q >> w;
a.func(q,w);
a.print();
return 0;
}
void A::func(int x,int y)
{
i=x;
j=y;
}
void A::print()
{
cout << i+j << endl;
}
又想了想,用这种最简单的类定义,friend和virtual都没有用到怎么可能是正解呢?
后来又花了N长时间想了想,发现用宏定义也可以
```c++
#include <iostream>
#define a using
#define b namespace
#define c std
#define d ;
#define e int
#define f main
#define g (
#define h )
#define i {
#define j }
#define k cin
#define l >>
#define m return
#define n ,
#define o cout
#define p <<
#define q endl
#define r +
#define s 0
#define t ios_base
#define u ::
#define v sync_with_stdio
a b c d
e f g h
i
t u v g s h d
e aaa n bbb d
k l aaa l bbb d
o p aaa r bbb p q d
m s d
j
```
于是求神人帮我用宏定义和类做出来吧
20 条评论
-
Jong-oo LV 8 @ 2020-03-05 00:14:55
做这题时,我是以为难度是越大越简单的...
-
@ 2020-02-29 11:48:11
无语
我也是
习惯用函数后,这么水的题都会这样了[喷血] -
@ 2019-06-22 13:14:38
宏定义:
#include<iostream>
#define _ long long int a,b
#define __ using namespace std
#define ___ int main()
#define ____ {
#define _____ cin>>a>>b
#define ______ cout<<a+b
#define _______ return 0
#define ________ }
__;
_;
_____;
______;
_______;
-
@ 2019-05-26 22:31:45
-
@ 2019-05-26 16:01:48
...
-
@ 2019-05-12 15:46:46
。。。
-
@ 2019-05-11 20:10:08
用退火不行吗,还有压位高精真的好用
-
@ 2019-04-18 20:44:17
print(sum(map(int, input().split()))) -
@ 2019-03-13 11:06:35
少年莫装B,装B遭雷劈
-
@ 2019-03-02 14:22:10
Java欢迎您
直接+就行 -
@ 2018-06-13 14:45:44
其实这题难度是⑨
-
@ 2018-05-26 19:43:16
大哥,咱能不要再**装B**了吗?这会非常让像我这样的*小蒟蒻*感到十分尴尬的
少年莫装B,装B遭雷劈
-
@ 2018-05-25 22:26:24
因为很多人想在这题装逼,失败了,难度才成9的
-
@ 2017-07-16 16:35:28
var a,b,c:longint;
begin
readln(a,b);
c:=a+b;
writeln(c);
end. -
@ 2017-06-27 19:17:12
puts("2333"); -
@ 2016-10-01 22:58:37
Orz
-
@ 2016-10-01 22:48:27
Orz
-
@ 2016-09-28 09:25:00
你是一个强者
-
@ 2016-09-26 20:09:39
program ex1;
type
xp=array[1..2] of longint;
var
a:xp;
begin
read(a[1],a[2]);
writeln(a[1]+a[2]);
end.
program ex2;
type
xp=array[1..2] of longint;
xp1=array[1,2] of xp;
var
a:xp1;
begin
read(a[1][1],a[2][2]);
writeln(a[1][1]+a[2][2]);
end.
program ex2;
var
a:array[1..2] of longint;
begin
read(a[1],a[2]);
writeln(a[1]+a[2]);
end. -
@ 2016-09-05 19:07:21
var
a,b:longint;
begin
readln(a,b);
writeln(a+b);
end.
- 1
信息
- ID
- 1000
- 难度
- 9
- 分类
- (无)
- 标签
- (无)
- 递交数
- 75073
- 已通过
- 28719
- 通过率
- 38%
- 被复制
- 261