結果

問題 No.148 試験監督(3)
ユーザー 👑 hos.lyrichos.lyric
提出日時 2015-02-13 10:27:44
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 746 ms / 1,000 ms
コード長 1,175 bytes
コンパイル時間 649 ms
コンパイル使用メモリ 21,376 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 19:43:39
合計ジャッジ時間 5,746 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 189 ms
5,248 KB
testcase_01 AC 282 ms
5,376 KB
testcase_02 AC 615 ms
5,376 KB
testcase_03 AC 674 ms
5,376 KB
testcase_04 AC 746 ms
5,376 KB
testcase_05 AC 547 ms
5,376 KB
testcase_06 AC 392 ms
5,376 KB
testcase_07 AC 606 ms
5,376 KB
testcase_08 AC 673 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:3:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    3 | i(long long n){y=1;for(e=M-2;e;e/=2,n=n*n%M)if(e&1)y=y*n%M;}
      | ^
main.c:4:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    4 | f(n){
      | ^
main.c: In function ‘f’:
main.c:4:1: warning: type of ‘n’ defaults to ‘int’ [-Wimplicit-int]
main.c: At top level:
main.c:21:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
   21 | main(t){
      | ^~~~
main.c: In function ‘main’:
main.c:21:1: warning: type of ‘t’ defaults to ‘int’ [-Wimplicit-int]
main.c:22:13: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
   22 |         for(scanf("%d",&t);t--;){
      |             ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | char C[10001],P[10001];
main.c:22:13: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
   22 |         for(scanf("%d",&t);t--;){
      |             ^~~~~
main.c:22:13: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:25:20: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
   25 |                 if(strlen(P)<11){
      |                    ^~~~~~
main.c:1:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
  +++ |+#include <string.h>
    1 | char C[10001],P[10001];
main.c:25:20: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch]
   25 |                 if(strlen(P)<11){
      |                    ^~~~~~
main.c:25:20: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
main.c:26:27: warning: implicit declaration of function ‘atoll’ [-Wimplicit-function-declaration]
   26 |                         p=atoll(P);
      |                           ^~~~~
main.c:33:17: warning: implicit d

ソースコード

diff #

char C[10001],P[10001];
long long M=1000000007,S=4600000,c,p,l,r,y,z,a,b,e,j;
i(long long n){y=1;for(e=M-2;e;e/=2,n=n*n%M)if(e&1)y=y*n%M;}
f(n){
	if(n>M/2){
		f(M-1-n);i(z);z=n%2?y:M-y;
	}else{
		z=1;
		if(n%S>S/2){
			for(;n%S;)z=z*++n%M;i(z);
		}else{
			for(;n%S;)z=z*n--%M;y=z;
		}
		z=0;
		for(j=0;j<5;)z=z<<6|
"    !9)KE\"DUX8B>30# U[O$..MV)WVR>^QX>C$BJ'D\\72-I[-7PZUN=C?V(:E'$E-\"/-<P:>Z.6(0>0#WV?#W/MUVC%9GCZG_U6KYMS9R]T%E1Q.DFYHIM28MFJ;M[1.P<TP^Q 9^WZJ6HEY=]5M*)@IVNL7 /)(*0B3#W8Q:V%Z33B83\\Y$1I@ZB_88' V_;HV)7G11J+7U$00) Y6QO#,T[VG6<+/_Y*1\"@3TU5?\"ZPIDH%2GH,4T]W0!B>^6;#?JE$(@?<PFXADDX]FH:*OF34,L9@HM,^:O&%7$P:6[UCMNI(F\\\\KHY\"P8!E_\"VJ3Q76A80/G4'RNL'7VE \"!EP4X$#V%5I9,>::$'?L8W6ZIV^F1L+(,>E.DN(JTJ$PIT7?[G:=[;-O3PYZMS+JG _ML+;',_:IQ \\WFA&?S$J,#C7%/'GPM,Y+C1]^18/P<05]<2JUZ4.SAU<XR2V&TJND6D[#AI>Z[V[R/5:NU#0UDU(1EV\\09<==3L<S^M0\\0Z$4E:R.:>J$2 ';U4;#!]>3\\+[IS$B\\!K.KE"
		[n/S*5+j++]-32;
		z=z*y%M;
	}
}
main(t){
	for(scanf("%d",&t);t--;){
		scanf("%s%s",C,P);
		a=0;
		if(strlen(P)<11){
			p=atoll(P);
			c=0;
			for(j=0;C[j];++j)c=(c*10+C[j]-48)%(M*99);
			r=c+1-p;
			l=r-p;
			l<0?:l/M<r/M?:(f(r%M),a=z,f(l%M),i(z),a=a*y%M);
		}
		printf("%lld\n",a);
	}
}
0