UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#215109#2656. addWZRYWZWY0441ms3132kbC++111.3kb2024-11-26 19:13:032024-11-26 23:01:15

answer

#include <bits/stdc++.h> //WZRYWZWY 自己写的 
using namespace std;
int main() {
	string s; cin >> s;
	s = ' ' + s;
	int n = s.length() - 1;
	for (int i = 1; i <= n; i++) {
		int r = i, r2 = i + (n - i) / 2, r3 = n, res = 0;
		bool t = 1;
		while (r2 > i && r > 0 && r3 > i + (n - i) / 2) {
			int p = (s[r]-'0' + s[r2]-'0');
			p += res;
			res = p / 10;
			p %= 10;
			if (p != (s[r3] - '0')) {
				t = 0; break;
			}
			r --; r2 --; r3 --;
		}
		if (t == 0) continue;
		if (r > 0 && r3 <= i + (n - i) / 2) continue;
		while (r > 0 && r3 > i + (n - i) / 2) {
			int p = s[r] - '0' + res;
			res = p / 10;
			p %= 10;
			if (p != s[r3] - '0') {
				t = 0; break;
			}
			r --; r3 --;
		}
		if (t == 0) continue;
		while (r2 > i && r3 > i + (n - i) / 2) {
			int p = s[r2] - '0' + res;
			res = p / 10;
			p %= 10;
			if (p != s[r3] - '0') {
				t = 0; break;
			}
			r2 --; r3 --;
		}
		if (t == 0) continue;
		//cout << r << ' ' << r2 << ' ' << r3 << "\n";
		for (int j = 1; j <= i; j++) cout << s[j];
		cout << "+";
		int j = i + 1;
		while (s[j] == '0' && j < i + (n - i) / 2) j ++;
		for (; j <= i + (n - i) / 2; j++) cout << s[j];
		cout << "=";
		while (s[j] == '0' && j < n) j ++;
		for (; j <= n; j++) cout << s[j];
		return 0;
	}
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 1196kb

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: 1200kb

input:

807674775734008076747757340

output:


result:

wrong answer 1st lines differ - expected: '8076747757340+0=8076747757340', found: ''

Test #4:

score: 0
Wrong Answer
time: 0ms
memory: 1196kb

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: 1196kb

input:

3150325920082064131504079841

output:


result:

wrong answer 1st lines differ - expected: '31503259200+820641=31504079841', found: ''

Test #7:

score: 0
Wrong Answer
time: 30ms
memory: 2868kb

input:

9261598869160335057970310229283612818845075445997339978957735823966059362624832990688056822195031820...

output:


result:

wrong answer 1st lines differ - expected: '926159886916033505797031022928...305423149747811305848245...

Test #8:

score: 0
Wrong Answer
time: 31ms
memory: 2868kb

input:

4701609646464966471786112512122938863110668626139644802941307402470417596440427343650542031038908331...

output:


result:

wrong answer 1st lines differ - expected: '470160964646496647178611251212...874839506012989821076236...

Test #9:

score: 0
Wrong Answer
time: 36ms
memory: 3132kb

input:

9257202799561473086244723527541134302291247300137775651258683390946286052100443441136004200934466749...

output:


result:

wrong answer 1st lines differ - expected: '925720279956147308624472352754...224390992473903259036223...

Test #10:

score: 0
Wrong Answer
time: 33ms
memory: 2868kb

input:

4416728326936622856150699213135191910979789931946758505266833530473668185681946524100519868737557117...

output:


result:

wrong answer 1st lines differ - expected: '441672832693662285615069921313...311161142168223354369848...

Test #11:

score: 0
Wrong Answer
time: 36ms
memory: 3128kb

input:

3061041362133228009344583160193669358685821190644364754039063887060686947993153784177860432362852231...

output:


result:

wrong answer 1st lines differ - expected: '306104136213322800934458316019...404229311233215356294943...

Test #12:

score: 0
Wrong Answer
time: 35ms
memory: 3132kb

input:

8531603642906385747583399978283975747482545589702570907905311483331351132043885935451850547243462360...

output:


result:

wrong answer 1st lines differ - expected: '853160364290638574758339997828...518092930085595438352541...

Test #13:

score: 0
Wrong Answer
time: 31ms
memory: 3132kb

input:

3334731073815946487356418721839719459473953466541212185094515699104064312397044785650155583747481091...

output:


result:

wrong answer 1st lines differ - expected: '333473107381594648735641872183...210446604616198937672761...

Test #14:

score: 0
Wrong Answer
time: 30ms
memory: 3128kb

input:

7113181137342253409543193679407457232222929505170124047879622285985297849800487899060254257891240998...

output:


result:

wrong answer 1st lines differ - expected: '711318113734225340954319367940...749958050118981453927074...

Test #15:

score: 0
Wrong Answer
time: 35ms
memory: 3128kb

input:

2226576415518523623432262365703901892218433052474981493103118406267304359951441730045611163295598279...

output:


result:

wrong answer 1st lines differ - expected: '222657641551852362343226236570...128354675474534145279551...

Test #16:

score: 0
Wrong Answer
time: 56ms
memory: 3128kb

input:

7282380568017210841065149843225478309106222219195648724985194189592224139941051182898879219925651713...

output:

7282380568017210841065149843225478309106222219195648724985194189592224139941051182898879219925651713...

result:

wrong answer 1st lines differ - expected: '728238056801721084106514984322...666502846844020958502573...

Test #17:

score: 0
Wrong Answer
time: 36ms
memory: 3132kb

input:

6172023021615818261278406139291452768117320772111777913293782100858187571870407831738505138788606992...

output:


result:

wrong answer 1st lines differ - expected: '617202302161581826127840613929...902285422850678432180522...

Test #18:

score: 0
Wrong Answer
time: 18ms
memory: 2336kb

input:

1641729471229192950020661455158841378773007409709289573050186474289570718374236969060246403530844480...

output:


result:

wrong answer 1st lines differ - expected: '164172947122919295002066145515...142828919589982198168364...

Test #19:

score: 0
Wrong Answer
time: 16ms
memory: 2084kb

input:

6878197288916471551222877849454599200431985721720556540869310866854759368074574456390764568703818252...

output:


result:

wrong answer 1st lines differ - expected: '687819728891647155122287784945...402811183606767898902074...

Test #20:

score: 0
Wrong Answer
time: 18ms
memory: 2080kb

input:

1336335135465815186373041570173603326293570642638147764739718555949768772153761126675803325646928488...

output:


result:

wrong answer 1st lines differ - expected: '133633513546581518637304157017...591665170585291620726485...