QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#28325#2951. Noonerized Spumbershld67890#AC ✓2ms2012kbC++171.7kb2022-04-13 16:20:492022-04-29 09:38:07

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-29 09:38:07]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:2012kb
  • [2022-04-13 16:20:49]
  • 提交

answer

#include <stdio.h>
#include <algorithm>
#include <string.h>

using namespace std;

char a[120] , b[120] , c[120];
long long la , lb , lc;
long long va , vb , vc;
char op[12] , e[12];
long long getnum ( char *z1 , long long l , char *z2 , long long r , long long mr ) {
	long long i , ret = 0;
	for ( i = 1 ; i <= l ; i++ ) {
		ret = ret * 10 + (z1[i]-'0');
	}
	for ( i = r ; i <= mr ; i++ ) {
		ret = ret * 10 + (z2[i]-'0');
	}
	return ret;
}
void check ( long long x , long long y , long long z ) {
	//printf ( "%d %d %d\n" , x , y , z );
	if ( op[1] == '+' ) {
		if ( x + y == z ) {
			printf ( "%lld + %lld = %lld\n" , x , y , z );
			exit(0);
		}
	}
	if ( op[1] == '*' ) {
		__int128 xx = x , yy = y;
		if ( xx * yy == z ) {
			printf ( "%lld * %lld = %lld\n" , x , y , z );
			exit(0);
		}
	}
}
void work () {
	long long i , j , k;
	scanf ( "%s%s%s%s%s" , a + 1 , op + 1 , b + 1 , e + 1 , c + 1 );
	la = strlen ( a + 1 );
	lb = strlen ( b + 1 );
	lc = strlen ( c + 1 );
	va = 0;
	for ( i = 1 ; i <= la ; i++ ) {
		va = va * 10 + (a[i]-'0');
	}
	vb = 0;
	for ( i = 1 ; i <= lb ; i++ ) {
		vb = vb * 10 + (b[i]-'0');
	}
	vc = 0;
	for ( i = 1 ; i <= lc ; i++ ) {
		vc = vc * 10 + (c[i]-'0');
	}
	for ( i = 1 ; i <= la ; i++ ) {
		for ( j = 1 ; j <= lb ; j++ ) {
			check ( getnum ( b , j , a , i + 1 , la ) , getnum ( a , i , b , j + 1 , lb ) , vc );
		}
		for ( j = 1 ; j <= lc ; j++ ) {
			check ( getnum ( c , j , a , i + 1 , la ) , vb , getnum ( a , i , c , j + 1 , lc ) );
		}
	}
	for ( i = 1 ; i <= lb ; i++ ) {
		for ( j = 1 ; j <= lc ; j++ ) {
			check ( va , getnum ( c , j , b , i + 1 , lb ) , getnum ( b , i , c , j + 1 , lc ) );
		}
	}
}
int main () {
	work ();
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 1820kb

input:

16861 * 829 = 46189

output:

16861 * 49 = 826189

result:

ok single line: '16861 * 49 = 826189'

Test #2:

score: 0
Accepted
time: 1ms
memory: 1708kb

input:

2055414 * 606 = 1236153644

output:

6014 * 205546 = 1236153644

result:

ok single line: '6014 * 205546 = 1236153644'

Test #3:

score: 0
Accepted
time: 1ms
memory: 1964kb

input:

16724 * 60282 = 24208168

output:

2724 * 60282 = 164208168

result:

ok single line: '2724 * 60282 = 164208168'

Test #4:

score: 0
Accepted
time: 0ms
memory: 1820kb

input:

22076 * 1615267 = 73134692

output:

22076 * 73167 = 1615234692

result:

ok single line: '22076 * 73167 = 1615234692'

Test #5:

score: 0
Accepted
time: 1ms
memory: 1824kb

input:

272753 * 9419 = 28908307

output:

28953 * 9419 = 272708307

result:

ok single line: '28953 * 9419 = 272708307'

Test #6:

score: 0
Accepted
time: 1ms
memory: 1764kb

input:

10 * 1 = 1000

output:

100 * 1 = 100

result:

ok single line: '100 * 1 = 100'

Test #7:

score: 0
Accepted
time: 1ms
memory: 1828kb

input:

178015070 * 61237 = 299590

output:

29070 * 61237 = 1780159590

result:

ok single line: '29070 * 61237 = 1780159590'

Test #8:

score: 0
Accepted
time: 1ms
memory: 1812kb

input:

10341 * 8509186 = 8229526

output:

10341 * 82286 = 850919526

result:

ok single line: '10341 * 82286 = 850919526'

Test #9:

score: 0
Accepted
time: 1ms
memory: 1824kb

input:

16065605 * 1143462 = 144110

output:

1405 * 1143462 = 1606564110

result:

ok single line: '1405 * 1143462 = 1606564110'

Test #10:

score: 0
Accepted
time: 1ms
memory: 1812kb

input:

215865 * 1370 = 1735050

output:

15865 * 1370 = 21735050

result:

ok single line: '15865 * 1370 = 21735050'

Test #11:

score: 0
Accepted
time: 1ms
memory: 2012kb

input:

6329928 * 34537 = 1834136

output:

18328 * 34537 = 632994136

result:

ok single line: '18328 * 34537 = 632994136'

Test #12:

score: 0
Accepted
time: 1ms
memory: 1764kb

input:

60915782 * 310478 = 19636

output:

1962 * 310478 = 609157836

result:

ok single line: '1962 * 310478 = 609157836'

Test #13:

score: 0
Accepted
time: 1ms
memory: 2008kb

input:

619035017 * 22095 = 28615

output:

28017 * 22095 = 619035615

result:

ok single line: '28017 * 22095 = 619035615'

Test #14:

score: 0
Accepted
time: 1ms
memory: 1824kb

input:

92231 * 63740 = 144781540

output:

14471 * 63740 = 922381540

result:

ok single line: '14471 * 63740 = 922381540'

Test #15:

score: 0
Accepted
time: 1ms
memory: 1776kb

input:

5908 * 510029 = 86331732

output:

5908 * 86329 = 510031732

result:

ok single line: '5908 * 86329 = 510031732'

Test #16:

score: 0
Accepted
time: 1ms
memory: 1824kb

input:

82829 * 18171 = 1502368359

output:

18129 * 82871 = 1502368359

result:

ok single line: '18129 * 82871 = 1502368359'

Test #17:

score: 0
Accepted
time: 1ms
memory: 1876kb

input:

99938 * 11316 = 1185634408

output:

11938 * 99316 = 1185634408

result:

ok single line: '11938 * 99316 = 1185634408'

Test #18:

score: 0
Accepted
time: 1ms
memory: 2012kb

input:

25 * 23466524 = 622385660

output:

23465 * 26524 = 622385660

result:

ok single line: '23465 * 26524 = 622385660'

Test #19:

score: 0
Accepted
time: 1ms
memory: 1764kb

input:

155614 * 21452 = 7252808

output:

7254 * 21452 = 155612808

result:

ok single line: '7254 * 21452 = 155612808'

Test #20:

score: 0
Accepted
time: 0ms
memory: 1824kb

input:

632012304 * 27016 = 23394

output:

23394 * 27016 = 632012304

result:

ok single line: '23394 * 27016 = 632012304'

Test #21:

score: 0
Accepted
time: 1ms
memory: 1772kb

input:

4698324 * 28 = 133066152

output:

28324 * 4698 = 133066152

result:

ok single line: '28324 * 4698 = 133066152'

Test #22:

score: 0
Accepted
time: 0ms
memory: 1820kb

input:

12296 * 132484 = 1071623264

output:

12296 * 107484 = 1321623264

result:

ok single line: '12296 * 107484 = 1321623264'

Test #23:

score: 0
Accepted
time: 1ms
memory: 2012kb

input:

1604697 * 989 = 1556261833

output:

9697 * 160489 = 1556261833

result:

ok single line: '9697 * 160489 = 1556261833'

Test #24:

score: 0
Accepted
time: 1ms
memory: 1824kb

input:

636023 * 30285 = 21681555

output:

21023 * 30285 = 636681555

result:

ok single line: '21023 * 30285 = 636681555'

Test #25:

score: 0
Accepted
time: 1ms
memory: 1824kb

input:

25843 * 117643 = 459552049

output:

25843 * 45643 = 1179552049

result:

ok single line: '25843 * 45643 = 1179552049'

Test #26:

score: 0
Accepted
time: 1ms
memory: 1712kb

input:

53122 * 17809 = 945802458

output:

17802 * 53129 = 945802458

result:

ok single line: '17802 * 53129 = 945802458'

Test #27:

score: 0
Accepted
time: 0ms
memory: 1796kb

input:

1109404 * 91505 = 12126620

output:

12124 * 91505 = 1109406620

result:

ok single line: '12124 * 91505 = 1109406620'

Test #28:

score: 0
Accepted
time: 1ms
memory: 1776kb

input:

87 * 7222663 = 597405501

output:

7227 * 82663 = 597405501

result:

ok single line: '7227 * 82663 = 597405501'

Test #29:

score: 0
Accepted
time: 1ms
memory: 1708kb

input:

12716 * 18220 = 228709520

output:

18716 * 12220 = 228709520

result:

ok single line: '18716 * 12220 = 228709520'

Test #30:

score: 0
Accepted
time: 1ms
memory: 1824kb

input:

12984 * 156920867 = 1337128

output:

12984 * 120867 = 1569337128

result:

ok single line: '12984 * 120867 = 1569337128'

Test #31:

score: 0
Accepted
time: 1ms
memory: 1820kb

input:

90988 * 5378 = 541183464

output:

5988 * 90378 = 541183464

result:

ok single line: '5988 * 90378 = 541183464'

Test #32:

score: 0
Accepted
time: 1ms
memory: 1768kb

input:

20024 * 157245 = 746753880

output:

20024 * 77245 = 1546753880

result:

ok single line: '20024 * 77245 = 1546753880'

Test #33:

score: 0
Accepted
time: 1ms
memory: 1804kb

input:

24451 * 6530 = 21861030

output:

24451 * 2530 = 61861030

result:

ok single line: '24451 * 2530 = 61861030'

Test #34:

score: 0
Accepted
time: 0ms
memory: 1772kb

input:

665 * 2699960 = 4000

output:

665 * 4060 = 2699900

result:

ok single line: '665 * 4060 = 2699900'

Test #35:

score: 0
Accepted
time: 2ms
memory: 1816kb

input:

14416738 + 22752859 = 1217469597

output:

121716738 + 22752859 = 144469597

result:

ok single line: '121716738 + 22752859 = 144469597'

Test #36:

score: 0
Accepted
time: 1ms
memory: 1828kb

input:

318261535 + 427030624 = 108892159

output:

318261535 + 108830624 = 427092159

result:

ok single line: '318261535 + 108830624 = 427092159'

Test #37:

score: 0
Accepted
time: 2ms
memory: 1884kb

input:

307419028 + 329135507 = 16554535

output:

307419028 + 19135507 = 326554535

result:

ok single line: '307419028 + 19135507 = 326554535'

Test #38:

score: 0
Accepted
time: 1ms
memory: 1768kb

input:

491092891 + 53632076 = 457824967

output:

491092891 + 45732076 = 536824967

result:

ok single line: '491092891 + 45732076 = 536824967'

Test #39:

score: 0
Accepted
time: 2ms
memory: 1816kb

input:

805068783 + 40943604 = 489972387

output:

409468783 + 80503604 = 489972387

result:

ok single line: '409468783 + 80503604 = 489972387'

Test #40:

score: 0
Accepted
time: 1ms
memory: 1820kb

input:

450061409 + 244972242 = 295033651

output:

250061409 + 244972242 = 495033651

result:

ok single line: '250061409 + 244972242 = 495033651'

Test #41:

score: 0
Accepted
time: 1ms
memory: 1960kb

input:

433642555 + 171789161 = 205431716

output:

233642555 + 171789161 = 405431716

result:

ok single line: '233642555 + 171789161 = 405431716'

Test #42:

score: 0
Accepted
time: 1ms
memory: 2004kb

input:

224538842 + 35145579 = 1268384421

output:

224538842 + 126845579 = 351384421

result:

ok single line: '224538842 + 126845579 = 351384421'

Test #43:

score: 0
Accepted
time: 1ms
memory: 1792kb

input:

414967101 + 4343764 = 1893910865

output:

414967101 + 18943764 = 433910865

result:

ok single line: '414967101 + 18943764 = 433910865'

Test #44:

score: 0
Accepted
time: 1ms
memory: 1800kb

input:

487976227 + 529361055 = 37337282

output:

487976227 + 39361055 = 527337282

result:

ok single line: '487976227 + 39361055 = 527337282'

Test #45:

score: 0
Accepted
time: 0ms
memory: 1772kb

input:

873454 * 326 = 283518144

output:

32454 * 8736 = 283518144

result:

ok single line: '32454 * 8736 = 283518144'

Test #46:

score: 0
Accepted
time: 1ms
memory: 1828kb

input:

462080479 + 492563058 = 30643537

output:

462080479 + 30563058 = 492643537

result:

ok single line: '462080479 + 30563058 = 492643537'

Test #47:

score: 0
Accepted
time: 1ms
memory: 1772kb

input:

278280530 + 475936329 = 196216859

output:

278280530 + 196936329 = 475216859

result:

ok single line: '278280530 + 196936329 = 475216859'

Test #48:

score: 0
Accepted
time: 1ms
memory: 1772kb

input:

425219889 + 148773065 = 276592954

output:

276519889 + 148773065 = 425292954

result:

ok single line: '276519889 + 148773065 = 425292954'

Test #49:

score: 0
Accepted
time: 1ms
memory: 1824kb

input:

286139519 + 43664213 = 1759803732

output:

286139519 + 173664213 = 459803732

result:

ok single line: '286139519 + 173664213 = 459803732'

Test #50:

score: 0
Accepted
time: 1ms
memory: 1772kb

input:

479472876 + 264504189 = 143977065

output:

179472876 + 264504189 = 443977065

result:

ok single line: '179472876 + 264504189 = 443977065'

Test #51:

score: 0
Accepted
time: 1ms
memory: 1960kb

input:

10731195 * 50670 = 2950650

output:

21195 * 50670 = 1073950650

result:

ok single line: '21195 * 50670 = 1073950650'

Test #52:

score: 0
Accepted
time: 0ms
memory: 1824kb

input:

534679200 + 20102624 = 514581824

output:

514579200 + 20102624 = 534681824

result:

ok single line: '514579200 + 20102624 = 534681824'

Test #53:

score: 0
Accepted
time: 1ms
memory: 1824kb

input:

415521538 + 514840047 = 90361585

output:

415521538 + 94840047 = 510361585

result:

ok single line: '415521538 + 94840047 = 510361585'

Test #54:

score: 0
Accepted
time: 1ms
memory: 1964kb

input:

426058009 + 499784873 = 65842882

output:

426058009 + 69784873 = 495842882

result:

ok single line: '426058009 + 69784873 = 495842882'

Test #55:

score: 0
Accepted
time: 1ms
memory: 1788kb

input:

574707686 + 43645760 = 494153446

output:

436707686 + 57445760 = 494153446

result:

ok single line: '436707686 + 57445760 = 494153446'

Test #56:

score: 0
Accepted
time: 0ms
memory: 1768kb

input:

16947 * 1110425 = 65552175

output:

16947 * 65525 = 1110452175

result:

ok single line: '16947 * 65525 = 1110452175'

Test #57:

score: 0
Accepted
time: 0ms
memory: 1824kb

input:

92 + 2803 = 669495

output:

6692 + 2803 = 9495

result:

ok single line: '6692 + 2803 = 9495'

Test #58:

score: 0
Accepted
time: 1ms
memory: 1768kb

input:

6891 * 723 = 4979753

output:

7291 * 683 = 4979753

result:

ok single line: '7291 * 683 = 4979753'