ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#215130 | #2656. add | NCZ_RACING | 0 | 0ms | 1200kb | C++ | 1.3kb | 2024-11-26 19:50:48 | 2024-11-26 23:02:45 |
answer
#include<bits/stdc++.h>
using namespace std;
const int LEN=1e6+5;
const int N=1e6+5;
string add(string str1,string str2)
{
string str;
int len1=str1.length();
int len2=str2.length();
if(len1<len2)
{
for(int i=1;i<=len2-len1;i++)
str1="0"+str1;
}
else
{
for(int i=1;i<=len1-len2;i++)
str2="0"+str2;
}
len1=str1.length();
int cf=0;
int temp;
for(int i=len1-1;i>=0;i--)
{
temp=str1[i]-'0'+str2[i]-'0'+cf;
cf=temp/10;
temp%=10;
str=char(temp+'0')+str;
}
if(cf!=0) str=char(cf+'0')+str;
return str;
}
int main(){
string s;
cin>>s;
int len=s.length();
for(int i=1;i<len;i++){
int lastlen=(len-i+1)/2;
int a,b,c;
a=s[i-1]-'0';
b=s[i+lastlen-1]-'0';
c=s[len-1]-'0';
if((a+b)%10!=c) continue;
//cout<<a<<b<<c<<'\n';
string t1,t2,t3;
t1=s.substr(0,i);
//cout<<t1<<'\n';
t2=s.substr(i,lastlen);
//cout<<t2<<'\n';
t3=s.substr(i+lastlen,len);
//cout<<t3<<'\n';
if(add(t1,t2)==t3){
cout<<t1<<'+'<<t2<<'='<<t3<<'\n';
return 0;
}
}
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 1200kb
input:
93944386991110939443869921
output:
result:
wrong answer 1st lines differ - expected: '939443869911+10=939443869921', found: ''
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 1200kb
input:
454431423351945476661
output:
result:
wrong answer 1st lines differ - expected: '45443142+33519=45476661', found: ''
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 1196kb
input:
807674775734008076747757340
output:
result:
wrong answer 1st lines differ - expected: '8076747757340+0=8076747757340', found: ''
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 1188kb
input:
47936157175791479437362
output:
result:
wrong answer 1st lines differ - expected: '479361571+75791=479437362', found: ''
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 1200kb
input:
8684160719450790868416071945079
output:
result:
wrong answer 1st lines differ - expected: '868416071945079+0=868416071945079', found: ''
Test #6:
score: 0
Wrong Answer
time: 0ms
memory: 1200kb
input:
3150325920082064131504079841
output:
result:
wrong answer 1st lines differ - expected: '31503259200+820641=31504079841', found: ''
Test #7:
score: 0
Time Limit Exceeded
input:
9261598869160335057970310229283612818845075445997339978957735823966059362624832990688056822195031820...
output:
result:
Test #8:
score: 0
Time Limit Exceeded
input:
4701609646464966471786112512122938863110668626139644802941307402470417596440427343650542031038908331...
output:
result:
Test #9:
score: 0
Time Limit Exceeded
input:
9257202799561473086244723527541134302291247300137775651258683390946286052100443441136004200934466749...
output:
result:
Test #10:
score: 0
Time Limit Exceeded
input:
4416728326936622856150699213135191910979789931946758505266833530473668185681946524100519868737557117...
output:
result:
Test #11:
score: 0
Time Limit Exceeded
input:
3061041362133228009344583160193669358685821190644364754039063887060686947993153784177860432362852231...
output:
result:
Test #12:
score: 0
Time Limit Exceeded
input:
8531603642906385747583399978283975747482545589702570907905311483331351132043885935451850547243462360...
output:
result:
Test #13:
score: 0
Time Limit Exceeded
input:
3334731073815946487356418721839719459473953466541212185094515699104064312397044785650155583747481091...
output:
result:
Test #14:
score: 0
Time Limit Exceeded
input:
7113181137342253409543193679407457232222929505170124047879622285985297849800487899060254257891240998...
output:
result:
Test #15:
score: 0
Time Limit Exceeded
input:
2226576415518523623432262365703901892218433052474981493103118406267304359951441730045611163295598279...
output:
result:
Test #16:
score: 0
Time Limit Exceeded
input:
7282380568017210841065149843225478309106222219195648724985194189592224139941051182898879219925651713...
output:
result:
Test #17:
score: 0
Time Limit Exceeded
input:
6172023021615818261278406139291452768117320772111777913293782100858187571870407831738505138788606992...
output:
result:
Test #18:
score: 0
Time Limit Exceeded
input:
1641729471229192950020661455158841378773007409709289573050186474289570718374236969060246403530844480...
output:
result:
Test #19:
score: 0
Time Limit Exceeded
input:
6878197288916471551222877849454599200431985721720556540869310866854759368074574456390764568703818252...
output:
result:
Test #20:
score: 0
Time Limit Exceeded
input:
1336335135465815186373041570173603326293570642638147764739718555949768772153761126675803325646928488...