QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#31752#21643. 多测不给大样例问题gsh#40 100ms6096kbC++23600b2022-05-12 10:29:282022-05-12 10:29:29

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-12 10:29:29]
  • 评测
  • 测评结果:40
  • 用时:100ms
  • 内存:6096kb
  • [2022-05-12 10:29:28]
  • 提交

answer

#include<algorithm>
#include<iostream>
#include<random>
#include<vector>
#include<cstdio>
using namespace std;
#define For(i,l,r) for(int i=l;i<=r;i++)
#define FOR(i,l,r) for(int i=l;i>=r;i--)
#define MAXN 30000001
int T,N,K;bool vis[MAXN];
int get(){int x=0,f=1;char c=getchar();while(c<'0'||c>'9')c=='-'&&(f=-1),c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*f;}
int main()
{
	T=get();
	while(T--)
	{
		N=get(),K=get();For(i,1,N)vis[i]=0;
		For(i,1,N){int x=i/__gcd(i,K);for(int j=x;j<i;j+=x)vis[j]=1;}
		int ans=0;For(i,1,N)ans+=vis[i];cout<<ans<<'\n';
	}
}

詳細信息

Test #1:

score: 10
Accepted
time: 4ms
memory: 3576kb

input:

10
5489 36
7152 51
6028 52
5449 51
4237 38
6459 24
4376 18
8918 4
9637 17
3835 29

output:

4172
4603
4244
3497
2756
4805
3080
5202
4188
1594

result:

ok 10 numbers

Test #2:

score: 10
Accepted
time: 1ms
memory: 3660kb

input:

10
5489 36
7152 51
6028 52
5449 51
4237 38
6459 24
4376 18
8918 4
9637 17
3835 29

output:

4172
4603
4244
3497
2756
4805
3080
5202
4188
1594

result:

ok 10 numbers

Test #3:

score: 10
Accepted
time: 100ms
memory: 6096kb

input:

10
548814 36
715190 51
602764 52
544884 51
423655 38
645895 24
437588 18
891774 4
963663 17
383442 29

output:

417037
459640
424323
350180
275682
480155
307555
520201
419692
160086

result:

ok 10 numbers

Test #4:

score: 10
Accepted
time: 96ms
memory: 5988kb

input:

10
548814 36
715190 51
602764 52
544884 51
423655 38
645895 24
437588 18
891774 4
963663 17
383442 29

output:

417037
459640
424323
350180
275682
480155
307555
520201
419692
160086

result:

ok 10 numbers

Test #5:

score: 0
Runtime Error

input:

40
108949032315 48
479687679697 46
171144669185 44
619301422333 11
115275514360 51
357658863077 18
435025021428 10
532397231890 46
831463813173 29
751774983526 13
331915882382 27
305069804446 45
781149541018 46
245297399117 45
716700187940 27
61309249885 20
546481966522 28
435548933326 47
4719749101...

output:


result:


Test #6:

score: 0
Runtime Error

input:

40
175313422703 41
668554077197 28
46515670365 3
742128007881 3
597769331487 57
473156474346 51
555734731567 13
536262552944 12
280927598505 7
733572833714 57
384137261807 56
691329695834 13
771944255405 24
618237624522 34
392255598870 52
834174408779 38
249378938395 42
561969968921 23
140146815381 ...

output:


result:


Test #7:

score: 0
Runtime Error

input:

40
137305220295 31
193845497145 7
962497300504 25
368785043518 8
953644561658 48
193025461331 36
840734481501 1
533572751059 33
196834696419 29
891413522825 26
962271824032 16
202601114680 16
694337374117 22
943323275350 47
569573675124 56
904629880258 8
370400863271 23
173999416545 3
391756029208 2...

output:


result:


Test #8:

score: 0
Runtime Error

input:

40
881016335236 48
638231672168 23
103399835277 60
614433314132 14
997269035780 55
223271883948 7
729216955531 7
835214784347 19
33057449007 60
638568044682 13
395718905847 51
433782552943 54
183782204284 8
305922876055 4
758641313049 13
88279097335 27
516887865419 57
755360065025 20
41306349942 15
...

output:


result:


Test #9:

score: 0
Runtime Error

input:

40
607133757272 46
838009504113 6
590986326994 22
855393603878 44
740162516232 53
217094184817 16
8492610764 7
42208309410 15
695394531401 39
609973215777 53
829974076649 59
375655472415 48
645002905745 29
417491209528 46
216159998106 56
600168186288 44
532747090211 10
709089965281 18
845106680415 5...

output:


result:


Test #10:

score: 0
Runtime Error

input:

40
731099174499 6
324727098669 18
845451652180 55
439615161896 35
400277785279 26
908689852003 8
263580613375 26
406650175007 24
705201256490 47
820334553144 29
825664216676 37
645202552816 34
948907755479 30
764621811758 24
849595370745 25
124514947739 53
47927748232 9
669177674276 59
263998454524 ...

output:


result: