QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#343113#6226. 取石子ushg88770 64ms3940kbC++14648b2024-03-01 22:35:062024-03-01 22:35:07

Judging History

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

  • [2024-03-01 22:35:07]
  • 评测
  • 测评结果:0
  • 用时:64ms
  • 内存:3940kb
  • [2024-03-01 22:35:06]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MP make_pair
mt19937 rnd(time(0));
ll f[90],s[90][90];
ll n,k,m;
void solve(){
	cin>>k>>n;
	for(int i=1;;i++) if(f[i]>k){
		m=i-1;break;
	}
	ll ans=0;
	for(int i=89;i>=1;i--){
		if(f[i]<n){
			ans+=s[i][m];
			n-=f[i];
		}
	}
	cout<<ans<<'\n';
}
int main(){
	ios::sync_with_stdio(false);
	f[0]=1,f[1]=1;
	for(int i=1;i<90;i++){
		f[i+1]=f[i]+f[i-1];
		s[i][i]=1;
		for(int j=1;j<=i;j++) s[i+1][j]=s[i-1][j]+s[i][j]-(j==i-1);
	}
	for(int i=1;i<90;i++) for(int j=1;j<90;j++) s[i][j]+=s[i][j-1];
	int _;cin>>_;
	while(_--) solve();
	return 0;
}

詳細信息

Test #1:

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

input:

499
336 455
5 9
420 424
35 57
9 424
55 71
38 414
64 346
42 480
18 212
37 249
82 488
6 190
75 165
51 272
13 37
29 143
44 195
71 175
149 180
42 245
62 376
193 285
47 207
128 145
5 209
281 329
9 437
258 296
2 31
70 240
268 356
21 93
147 180
79 115
63 106
112 443
219 305
332 476
47 450
134 290
51 89
243...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '453', found: '0'

Test #2:

score: 0
Wrong Answer
time: 15ms
memory: 3808kb

input:

49875
14399 29607
6224 29914
1106 26641
17 26569
6365 25718
27 4637
1618 2714
33573 40913
35563 36097
8973 28132
5673 25161
17636 34907
6000 10087
4467 7440
8334 49937
259 20572
6268 28505
6401 15802
12571 13234
23041 27538
2493 47406
5802 10423
11962 30757
3300 3837
8350 20422
225 16103
23645 34285...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '29604', found: '0'

Test #3:

score: 0
Wrong Answer
time: 46ms
memory: 3752kb

input:

94256
53191 66970
85363 96281
23759 25693
28568 43227
27 31316
10224 32226
9111 25249
16987 19389
15006 30353
9523 59244
42546 55606
6039 6830
5609 54488
2509 12330
29480 70960
14785 65267
60831 91903
281 18175
31994 76610
3582 9689
7665 34764
12673 18964
16448 22115
5748 30321
33618 49834
18843 244...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '66969', found: '0'

Test #4:

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

input:

3
34279 810634
918771 1021048
25 42120

output:

0
0
0

result:

wrong answer 1st lines differ - expected: '810613', found: '0'

Test #5:

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

input:

3
690379 1982172
417599 1708659
1717080 2863950

output:

0
0
0

result:

wrong answer 1st lines differ - expected: '1982169', found: '0'

Test #6:

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

input:

944
1 343954967570505156
1 84731075985818925
1 138311144113583007
1 104547054550584433
1 693241347397247084
1 472332079344024358
1 156793474620214247
1 850344749061699637
1 803512580085688163
1 310836022836048564
1 495053169351075063
1 82844446500137324
1 178945557527795821
1 216483389996708327
1 59...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '131379107012565125', found: '0'

Test #7:

score: 0
Wrong Answer
time: 44ms
memory: 3888kb

input:

91665
1 367380666905152293
1 182005789689897190
1 623096247285159354
1 671594325644512277
1 742160204799780654
1 794275980040994924
1 74354650304567324
1 911166360819358930
1 764757676441890048
1 752269248988307295
1 955093740058796962
1 747803753737785010
1 404138290206507311
1 181396406609700806
1...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '140326927948164534', found: '0'

Test #8:

score: 0
Wrong Answer
time: 2ms
memory: 3868kb

input:

911
78374152724567593 983112666946547816
753553157811176669 788891899819251115
33856693441045857 281513707367405940
458492126183900287 469318687938414816
20297113357777935 33378284552002778
10115955709864055 787679629225677540
17150232293760847 102828488233093971
112680441700253174 12938526751175947...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '983112666946547804', found: '0'

Test #9:

score: 0
Wrong Answer
time: 64ms
memory: 3804kb

input:

98295
873150664261731328 951581568702046682
56 727890463110977051
859978062141145093 947945138127019948
330253590080540990 768615565614466064
13256179404231692 95760438247048090
638707615934448347 792288571729874417
54711657924896980 847301161318887407
856185831773980409 893587664123567425
312798854...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '951581568702046681', found: '0'

Test #10:

score: 0
Wrong Answer
time: 44ms
memory: 3812kb

input:

91640
405786310369032226 553800146036810186
84 288402474700211717
19845023439645913 392170479523345754
597697212044203925 702078911619194971
11204130783741609 13290697100124817
23 484543424049569697
559463321235963921 601484656718057819
227796568880241875 992739563025444500
156735875816653837 901104...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '553800146036810184', found: '0'