两小于10大于0的数相加应该怎么写?
usrbin吧
全部回复
仅看楼主
level 11
闹事堂风 楼主
不知道怎么做到最快啊[揉脸]还有如果是大数呢?(0<=a,b<=10^18)。long long?
2011年10月09日 13点10分 1
level 11
....你想搞指令集级别的优化吗..
2011年10月09日 13点10分 2
level 11
闹事堂风 楼主
不是,很好奇。。。我写的要8ms别人是0ms 很好奇代码是怎样的。。。
2011年10月09日 13点10分 3
level 11
闹事堂风 楼主
还有那个大数我用long long 和unsigned long long 提交上去直接错误 无语。
2011年10月09日 13点10分 4
level 11
..你同一个程序交上去时间都可能不一样
2011年10月09日 13点10分 5
level 11
闹事堂风 楼主
[啊!]晕死
2011年10月09日 13点10分 6
level 11
显然OJ的机器上不止你一个程序在跑
2011年10月09日 13点10分 7
level 11
闹事堂风 楼主
(0<=a,b<=10^18)这种范围的两数相加呢?用什么...
我懂你的意思了,,,都是现在的伪并行运算惹的祸吧。。
2011年10月09日 13点10分 8
level 11
你检查你的输出有没有错误
2011年10月09日 13点10分 9
level 11
闹事堂风 楼主
在我电脑上正常...
我贴下题目吧
Description
Calculate a+b again, but a and b will be huge. You can
assume that the answer will be fit in 64-bit integer.
Input
There will be several test case in the input files.
For every case, there are two integer a,b.(0<=a,b<=10^18)
Output
Output a+b.
Sample Input
1234567891011121314 14
13121110987
654321
1000000000 2000000000
Sample Output
2647689001998775635
3000000000
2011年10月09日 13点10分 10
level 11
闹事堂风 楼主
#include <iostream>
using namespace std;
int main()
{
long long a,b;
cin >> a >> b;
cout << a + b << endl;
return 0;
}
代码是这个
2011年10月09日 14点10分 11
level 11
用__int64呢?
2011年10月09日 14点10分 12
level 11
闹事堂风 楼主
#include <iostream>
using namespace std;
int main()
{
__int64 a,b;
cin >> a >> b;
cout << a + b << endl;
return 0;
}
结果是Compile Error(?)。。。。。。。。。。。。
2011年10月09日 14点10分 13
level 11
突然看见你那题目是多组输入数据..你程序只处理了一组
2011年10月09日 14点10分 14
level 11
那就说明你们的oj是运行在linux系统上的
2011年10月09日 14点10分 15
level 11
闹事堂风 楼主
#include <iostream>
using namespace std;
int main()
{
long long a,b,c,d;
cin >> a >> b >> c >> d;
cout << a + b << endl;
cout << c + d << endl;
return 0;
}
wrong answer。。。
2011年10月09日 14点10分 16
level 11
不一定是2组[汗]
2011年10月09日 14点10分 17
level 11
闹事堂风 楼主
http://cx2011.galaxywind.com/oj/problems.php
1002题,你去看看吧。有点纠结
2011年10月09日 14点10分 18
level 11
闹事堂风 楼主
[汗]
2011年10月09日 14点10分 19
level 11
2011年10月09日 14点10分 20
1 2 尾页