結果

問題 No.148 試験監督(3)
ユーザー 👑 hos.lyrichos.lyric
提出日時 2015-02-13 10:27:44
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 787 ms / 1,000 ms
コード長 1,175 bytes
コンパイル時間 740 ms
コンパイル使用メモリ 25,684 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 00:38:00
合計ジャッジ時間 6,583 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 193 ms
4,380 KB
testcase_01 AC 295 ms
4,380 KB
testcase_02 AC 645 ms
4,380 KB
testcase_03 AC 707 ms
4,376 KB
testcase_04 AC 787 ms
4,376 KB
testcase_05 AC 574 ms
4,376 KB
testcase_06 AC 415 ms
4,380 KB
testcase_07 AC 641 ms
4,380 KB
testcase_08 AC 716 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:3:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
 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]
 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]
 main(t){
 ^~~~
main.c: In function ‘main’:
main.c:21:1: warning: type of ‘t’ defaults to ‘int’ [-Wimplicit-int]
main.c:22:6: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
  for(scanf("%d",&t);t--;){
      ^~~~~
main.c:22:6: warning: incompatible implicit declaration of built-in function ‘scanf’
main.c:22:6: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:1:1:
+#include <stdio.h>
 char C[10001],P[10001];
main.c:22:6:
  for(scanf("%d",&t);t--;){
      ^~~~~
main.c:25:6: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
   if(strlen(P)<11){
      ^~~~~~
main.c:25:6: warning: incompatible implicit declaration of built-in function ‘strlen’
main.c:25:6: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
main.c:1:1:
+#include <string.h>
 char C[10001],P[10001];
main.c:25:6:
   if(strlen(P)<11){
      ^~~~~~
main.c:26:6: warning: implicit declaration of function ‘atoll’ [-Wimplicit-function-declaration]
    p=atoll(P);
      ^~~~~
main.c:33:3: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
   printf("%lld\n",a);
   ^~~~~~
main.c:33:3: warning: incompatible implicit declaration of built-in function ‘printf’
main.c:33:3: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’

ソースコード

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