結果

問題 No.843 Triple Primes
ユーザー tails
提出日時 2019-08-14 09:32:53
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 434 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 28,544 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-19 14:27:21
合計ジャッジ時間 1,251 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 42
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:2:1: warning: return type defaults to 'int' [-Wimplicit-int]
    2 | main(){
      | ^~~~
main.c: In function 'main':
main.c:6:9: warning: implicit declaration of function 'read' [-Wimplicit-function-declaration]
    6 |         read(0,s,20);
      |         ^~~~
main.c:11:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
   11 |         write(1,p,s+20-p);
      |         ^~~~~

ソースコード

diff #

int a[]={7,23,47,167,359,839,1367,1847,2207,3719,5039,7919,10607,11447,16127,17159,19319,29927,36479,44519,49727,54287,57119,66047,85847,97967,113567,128879,177239,196247,201599,218087,241079,273527,292679,323759,344567,368447,426407,458327,500001};
main(){
	int n,i,c;
	char s[20],*p;
	n=0;
	read(0,s,20);
	for(p=s;c=*p++-48,c>=0;n=n*10+c);
	for(i=0;a[i]<=n;++i);
	n=i*2+(n>1);
	for(p=s+20;*--p=n%10+48,n/=10;);
	write(1,p,s+20-p);
}
0