1323 条题解
-
-1lumingjia LV 8 @ 2016-07-04 19:30:26
#include<stdio.h>
int main()
{
int a,b;
int sum;
scanf("%d %d",&a,&b);
sum=a+b;
printf("%d",sum);
} -
-12016-06-20 11:36:50@
program ex1_1;
var a,b,c:real;
begin
read(a,b);
c:=a+b;
writeln('c=',c);
end. -
-12016-06-04 17:02:32@
var
a,b:integer;
begin
readln(a,b);
writeln(a+b);
end.
这题“太难了”!!! -
-12016-05-17 12:58:45@
var a,b;
begin
read(a,b);
inc(a,b);
write(a);
end. -
-12016-05-11 21:10:46@
我要在这里练一下
A+B Problem题解
##**最简单**的做法!
附上:度娘传送门
太简单啦!
话说代码高亮好像**不支持Java!!!**
我要试一下
java
import java.util.Scanner;
public class Main{
public static void main(String []args){
Scanner in=new Scanner(System.in);//新建扫描仪(其实就是输入用的啦)
int a=in.nextInt(),b=in.nextInt();//使用刚刚新建的扫描仪来输入加数
int ans=a+b;//这一个全国通用......
System.out.println(ans);//输出不解释......
}
}
现在看来话说好像**支持Java啊** -
-12015-10-23 19:38:09@
var
a,b:integer;
begin
read(a,b);
writeln(a+b);
end. -
-12015-10-18 21:13:47@
var
a,b:integer;
begin
readln(a,b);
writeln(a+b);
end. -
-12015-10-18 20:35:09@
var
a,b:integer;
begin
readln(a,b);
writeln(a+b);
end. -
-12015-10-18 09:09:06@
#include<stdio.h>
main()
{
int a,b;
scanf("%d %d",&a,&b);
printf("%d",a+b);
return 0;
} -
-12015-10-02 14:55:20@
谁会做啊!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-12015-10-02 14:55:03@
太难了,我想了好长好长好长一段时间,太难了,不会做,难度是九啊,多学学高级知识才能做,太难了
-
-12015-09-29 13:34:03@
#include<cstdio>
using namespace std;
int main()
{
int a,b;
scanf("%d%d",&a,&b);
printf("%d",a+b);
return 0;
}
史上最好,最完美,最厉害,最纯真,最无敌,最安全,最ac的题解 -
-12015-09-27 16:09:30@
被坑了!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!不是高精度加法!!!!!!!!!!!!!太简单了!!!!!!!!!!!!!!!!!!!!!!111
-
-12015-09-25 21:21:18@
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
cout << a + b << endl;
return 0;
} -
-12015-09-16 20:14:34@
var a,b:longint;
begin
readln(a,b);
writeln(a+b);
end.
PACAL算法!。 -
-12015-09-12 15:20:32@
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
cout << a + b << endl;
return 0;
} -
-12015-08-14 11:35:15@
AC
#include <cstdio>
int main()
{
int a, b;
scanf("%d%d", &a, &b);
printf("%d\n", a + b);
return 0;
} -
-12015-07-31 19:24:36@
记录信息
评测状态 Accepted
题目 P1000 A+B Problem
递交时间 2015-07-31 19:23:11
代码语言 C++
评测机 VijosEx
消耗时间 22 ms
消耗内存 532 KiB
评测时间 2015-07-31 19:23:15评测结果
编译成功测试数据 #0: Accepted, time = 0 ms, mem = 524 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 524 KiB, score = 10
测试数据 #2: Accepted, time = 0 ms, mem = 524 KiB, score = 10
测试数据 #3: Accepted, time = 1 ms, mem = 528 KiB, score = 10
测试数据 #4: Accepted, time = 15 ms, mem = 532 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 524 KiB, score = 10
测试数据 #6: Accepted, time = 0 ms, mem = 524 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 524 KiB, score = 10
测试数据 #8: Accepted, time = 6 ms, mem = 524 KiB, score = 10
测试数据 #9: Accepted, time = 0 ms, mem = 524 KiB, score = 10
Accepted, time = 22 ms, mem = 532 KiB, score = 100
代码
#include<iostream>
#include<string>
//定义精度位数常量<255
using namespace std;
int strbj(string aa,string bb)
//字符串比较
{
int la=aa.length();
int lb=bb.length();
if(la>lb)return 1;
if(la<lb)return 0;
if(aa>bb)return 1;
return 0;
}
string gjdqh(string a,string b)
//高精度加法c++,by pengyao1207
{
int t=0;
int jw=0;
int la=a.length();
int lb=b.length();
string c="";
int ka=la-1;
int kb=lb-1;
int km=(la<lb?la:lb);
int ll=(la>lb)?(la-lb):(lb-la);
for(int i=1;i<=km;i++)
{
t=a[ka]+b[kb]-96+jw;
c.insert(0,1,char((t%10)+48));
jw=((t>9)?1:0);
ka--;
kb--;
}
if(la>lb)
for(int i=1;i<=ll;i++)
{
t=a[ka]-48+jw;
c.insert(0,1,char((t%10)+48));
jw=((t>9)?1:0);
ka--;
}
else
for(int i=1;i<=ll;i++)
{
t=b[kb]-48+jw;
c.insert(0,1,char((t%10)+48));
jw=((t>9)?1:0);
kb--;
}
if(jw==1)c="1"+c;
return c;
}
string gjdqc(string a,string b)
//高精度减法c++,by pengyao1207
{
int la=a.length();
int lb=b.length();
string c="";
int ka=la-1;
int kb=lb-1;
int km=lb;
int ll=la-lb;
for(int i=1;i<=km;i++)
{
if(a[ka]<b[kb])
{
a[ka]=a[ka]+10;
a[ka-1]--;
}
c.insert(0,1,char(a[ka]-b[kb]+48));
ka--;
kb--;
}
for(int i=1;i<=ll;i++)
{
if(a[ka]<48)
{
c.insert(0,1,'9');
a[ka-1]--;
}
else c.insert(0,1,a[ka]);
ka--;
}
while((c[0]=='0')&&(c.length()!=1))c.erase(0,1);
return c;
}
string gjdqj(string a,string b)
//高精度乘法c++,by pengyao1207
{
string str="0";
string fz[10];
int lb=b.length();
int kb=lb-1;
fz[0]="0";
fz[1]=a;
fz[2]=gjdqh(fz[1],a);
fz[3]=gjdqh(fz[2],a);
fz[4]=gjdqh(fz[3],a);
fz[5]=gjdqh(fz[4],a);
fz[6]=gjdqh(fz[5],a);
fz[7]=gjdqh(fz[6],a);
fz[8]=gjdqh(fz[7],a);
fz[9]=gjdqh(fz[8],a);
int sl;
for(int i=0;i<=kb;i++)
{
string str1="0";
str1=fz[b[i]-48];
sl=kb-i;
//for(int k=1;k<=sl;k++)str1=str1+"0";
str1.insert(str1.length(),sl,'0');
str=gjdqh(str1,str);
}
while((str[0]=='0')&&(str.length()!=1))str.erase(0,1);
return str;
}
string gjdqs(string a,string b)
//高精度除法c++,by pengyao1207
{
int la=a.length();
int ka=la-1;
string str="";
string ys="0";
int zds;
string fz[10];
fz[0]="0";
fz[1]=b;
fz[2]=gjdqh(fz[1],b);
fz[3]=gjdqh(fz[2],b);
fz[4]=gjdqh(fz[3],b);
fz[5]=gjdqh(fz[4],b);
fz[6]=gjdqh(fz[5],b);
fz[7]=gjdqh(fz[6],b);
fz[8]=gjdqh(fz[7],b);
fz[9]=gjdqh(fz[8],b);
for(int i=0;i<=ka;i++)
{
if(ys=="0")ys=a[i];else
{
ys.insert(ys.length(),1,'0');
ys=gjdqh(ys,a.substr(i,1));
}
zds=9;
for(int j=1;j<=9;j++)
{
if(strbj(fz[j],ys))
{
zds=j-1;
break;
}
}
str.insert(str.length(),1,char(zds+48));
ys=gjdqc(ys,fz[zds]);
}
while((str[0]=='0')&&(str.length()!=1))str.erase(0,1);
return str;
}
int main()
{
string a,b;
cin>>a>>b;
cout<<gjdqh(a,b);
}
记录信息
评测状态 Accepted
题目 P1000 A+B Problem
递交时间 2015-07-31 19:23:11
代码语言 C++
评测机 VijosEx
消耗时间 22 ms
消耗内存 532 KiB
评测时间 2015-07-31 19:23:15评测结果
编译成功测试数据 #0: Accepted, time = 0 ms, mem = 524 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 524 KiB, score = 10
测试数据 #2: Accepted, time = 0 ms, mem = 524 KiB, score = 10
测试数据 #3: Accepted, time = 1 ms, mem = 528 KiB, score = 10
测试数据 #4: Accepted, time = 15 ms, mem = 532 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 524 KiB, score = 10
测试数据 #6: Accepted, time = 0 ms, mem = 524 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 524 KiB, score = 10
测试数据 #8: Accepted, time = 6 ms, mem = 524 KiB, score = 10
测试数据 #9: Accepted, time = 0 ms, mem = 524 KiB, score = 10
Accepted, time = 22 ms, mem = 532 KiB, score = 100
代码
#include<iostream>
#include<string>
//定义精度位数常量<255
using namespace std;
int strbj(string aa,string bb)
//字符串比较
{
int la=aa.length();
int lb=bb.length();
if(la>lb)return 1;
if(la<lb)return 0;
if(aa>bb)return 1;
return 0;
}
string gjdqh(string a,string b)
//高精度加法c++,by pengyao1207
{
int t=0;
int jw=0;
int la=a.length();
int lb=b.length();
string c="";
int ka=la-1;
int kb=lb-1;
int km=(la<lb?la:lb);
int ll=(la>lb)?(la-lb):(lb-la);
for(int i=1;i<=km;i++)
{
t=a[ka]+b[kb]-96+jw;
c.insert(0,1,char((t%10)+48));
jw=((t>9)?1:0);
ka--;
kb--;
}
if(la>lb)
for(int i=1;i<=ll;i++)
{
t=a[ka]-48+jw;
c.insert(0,1,char((t%10)+48));
jw=((t>9)?1:0);
ka--;
}
else
for(int i=1;i<=ll;i++)
{
t=b[kb]-48+jw;
c.insert(0,1,char((t%10)+48));
jw=((t>9)?1:0);
kb--;
}
if(jw==1)c="1"+c;
return c;
}
string gjdqc(string a,string b)
//高精度减法c++,by pengyao1207
{
int la=a.length();
int lb=b.length();
string c="";
int ka=la-1;
int kb=lb-1;
int km=lb;
int ll=la-lb;
for(int i=1;i<=km;i++)
{
if(a[ka]<b[kb])
{
a[ka]=a[ka]+10;
a[ka-1]--;
}
c.insert(0,1,char(a[ka]-b[kb]+48));
ka--;
kb--;
}
for(int i=1;i<=ll;i++)
{
if(a[ka]<48)
{
c.insert(0,1,'9');
a[ka-1]--;
}
else c.insert(0,1,a[ka]);
ka--;
}
while((c[0]=='0')&&(c.length()!=1))c.erase(0,1);
return c;
}
string gjdqj(string a,string b)
//高精度乘法c++,by pengyao1207
{
string str="0";
string fz[10];
int lb=b.length();
int kb=lb-1;
fz[0]="0";
fz[1]=a;
fz[2]=gjdqh(fz[1],a);
fz[3]=gjdqh(fz[2],a);
fz[4]=gjdqh(fz[3],a);
fz[5]=gjdqh(fz[4],a);
fz[6]=gjdqh(fz[5],a);
fz[7]=gjdqh(fz[6],a);
fz[8]=gjdqh(fz[7],a);
fz[9]=gjdqh(fz[8],a);
int sl;
for(int i=0;i<=kb;i++)
{
string str1="0";
str1=fz[b[i]-48];
sl=kb-i;
//for(int k=1;k<=sl;k++)str1=str1+"0";
str1.insert(str1.length(),sl,'0');
str=gjdqh(str1,str);
}
while((str[0]=='0')&&(str.length()!=1))str.erase(0,1);
return str;
}
string gjdqs(string a,string b)
//高精度除法c++,by pengyao1207
{
int la=a.length();
int ka=la-1;
string str="";
string ys="0";
int zds;
string fz[10];
fz[0]="0";
fz[1]=b;
fz[2]=gjdqh(fz[1],b);
fz[3]=gjdqh(fz[2],b);
fz[4]=gjdqh(fz[3],b);
fz[5]=gjdqh(fz[4],b);
fz[6]=gjdqh(fz[5],b);
fz[7]=gjdqh(fz[6],b);
fz[8]=gjdqh(fz[7],b);
fz[9]=gjdqh(fz[8],b);
for(int i=0;i<=ka;i++)
{
if(ys=="0")ys=a[i];else
{
ys.insert(ys.length(),1,'0');
ys=gjdqh(ys,a.substr(i,1));
}
zds=9;
for(int j=1;j<=9;j++)
{
if(strbj(fz[j],ys))
{
zds=j-1;
break;
}
}
str.insert(str.length(),1,char(zds+48));
ys=gjdqc(ys,fz[zds]);
}
while((str[0]=='0')&&(str.length()!=1))str.erase(0,1);
return str;
}
int main()
{
string a,b;
cin>>a>>b;
cout<<gjdqh(a,b);
}
记录信息
评测状态 Accepted
题目 P1000 A+B Problem
递交时间 2015-07-31 19:23:11
代码语言 C++
评测机 VijosEx
消耗时间 22 ms
消耗内存 532 KiB
评测时间 2015-07-31 19:23:15评测结果
编译成功测试数据 #0: Accepted, time = 0 ms, mem = 524 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 524 KiB, score = 10
测试数据 #2: Accepted, time = 0 ms, mem = 524 KiB, score = 10
测试数据 #3: Accepted, time = 1 ms, mem = 528 KiB, score = 10
测试数据 #4: Accepted, time = 15 ms, mem = 532 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 524 KiB, score = 10
测试数据 #6: Accepted, time = 0 ms, mem = 524 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 524 KiB, score = 10
测试数据 #8: Accepted, time = 6 ms, mem = 524 KiB, score = 10
测试数据 #9: Accepted, time = 0 ms, mem = 524 KiB, score = 10
Accepted, time = 22 ms, mem = 532 KiB, score = 100
代码
#include<iostream>
#include<string>
//定义精度位数常量<255
using namespace std;
int strbj(string aa,string bb)
//字符串比较
{
int la=aa.length();
int lb=bb.length();
if(la>lb)return 1;
if(la<lb)return 0;
if(aa>bb)return 1;
return 0;
}
string gjdqh(string a,string b)
//高精度加法c++,by pengyao1207
{
int t=0;
int jw=0;
int la=a.length();
int lb=b.length();
string c="";
int ka=la-1;
int kb=lb-1;
int km=(la<lb?la:lb);
int ll=(la>lb)?(la-lb):(lb-la);
for(int i=1;i<=km;i++)
{
t=a[ka]+b[kb]-96+jw;
c.insert(0,1,char((t%10)+48));
jw=((t>9)?1:0);
ka--;
kb--;
}
if(la>lb)
for(int i=1;i<=ll;i++)
{
t=a[ka]-48+jw;
c.insert(0,1,char((t%10)+48));
jw=((t>9)?1:0);
ka--;
}
else
for(int i=1;i<=ll;i++)
{
t=b[kb]-48+jw;
c.insert(0,1,char((t%10)+48));
jw=((t>9)?1:0);
kb--;
}
if(jw==1)c="1"+c;
return c;
}
string gjdqc(string a,string b)
//高精度减法c++,by pengyao1207
{
int la=a.length();
int lb=b.length();
string c="";
int ka=la-1;
int kb=lb-1;
int km=lb;
int ll=la-lb;
for(int i=1;i<=km;i++)
{
if(a[ka]<b[kb])
{
a[ka]=a[ka]+10;
a[ka-1]--;
}
c.insert(0,1,char(a[ka]-b[kb]+48));
ka--;
kb--;
}
for(int i=1;i<=ll;i++)
{
if(a[ka]<48)
{
c.insert(0,1,'9');
a[ka-1]--;
}
else c.insert(0,1,a[ka]);
ka--;
}
while((c[0]=='0')&&(c.length()!=1))c.erase(0,1);
return c;
}
string gjdqj(string a,string b)
//高精度乘法c++,by pengyao1207
{
string str="0";
string fz[10];
int lb=b.length();
int kb=lb-1;
fz[0]="0";
fz[1]=a;
fz[2]=gjdqh(fz[1],a);
fz[3]=gjdqh(fz[2],a);
fz[4]=gjdqh(fz[3],a);
fz[5]=gjdqh(fz[4],a);
fz[6]=gjdqh(fz[5],a);
fz[7]=gjdqh(fz[6],a);
fz[8]=gjdqh(fz[7],a);
fz[9]=gjdqh(fz[8],a);
int sl;
for(int i=0;i<=kb;i++)
{
string str1="0";
str1=fz[b[i]-48];
sl=kb-i;
//for(int k=1;k<=sl;k++)str1=str1+"0";
str1.insert(str1.length(),sl,'0');
str=gjdqh(str1,str);
}
while((str[0]=='0')&&(str.length()!=1))str.erase(0,1);
return str;
}
string gjdqs(string a,string b)
//高精度除法c++,by pengyao1207
{
int la=a.length();
int ka=la-1;
string str="";
string ys="0";
int zds;
string fz[10];
fz[0]="0";
fz[1]=b;
fz[2]=gjdqh(fz[1],b);
fz[3]=gjdqh(fz[2],b);
fz[4]=gjdqh(fz[3],b);
fz[5]=gjdqh(fz[4],b);
fz[6]=gjdqh(fz[5],b);
fz[7]=gjdqh(fz[6],b);
fz[8]=gjdqh(fz[7],b);
fz[9]=gjdqh(fz[8],b);
for(int i=0;i<=ka;i++)
{
if(ys=="0")ys=a[i];else
{
ys.insert(ys.length(),1,'0');
ys=gjdqh(ys,a.substr(i,1));
}
zds=9;
for(int j=1;j<=9;j++)
{
if(strbj(fz[j],ys))
{
zds=j-1;
break;
}
}
str.insert(str.length(),1,char(zds+48));
ys=gjdqc(ys,fz[zds]);
}
while((str[0]=='0')&&(str.length()!=1))str.erase(0,1);
return str;
}
int main()
{
string a,b;
cin>>a>>b;
cout<<gjdqh(a,b);
} -
-12015-07-25 21:39:08@
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
cout << a + b << endl;
return 0;
} -
-12015-07-25 21:35:00@
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
cout << a + b << endl;
return 0;
}
信息
- ID
- 1000
- 难度
- 9
- 分类
- (无)
- 标签
- (无)
- 递交数
- 74449
- 已通过
- 28495
- 通过率
- 38%
- 被复制
- 223