結果
| 問題 |
No.791 うし数列
|
| コンテスト | |
| ユーザー |
Kakisuke
|
| 提出日時 | 2019-08-06 21:07:01 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 517 bytes |
| コンパイル時間 | 91 ms |
| コンパイル使用メモリ | 20,992 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 14:26:18 |
| 合計ジャッジ時間 | 806 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 5 WA * 8 RE * 2 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%d",&n);
| ^~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int main()
{
int n,sum=10,i;
for(i=2;i<=100;i++){
sum=sum*10;
}
char buf[sum];
scanf("%d",&n);
sprintf(buf,"%d",n);
i=0;
while(1){
if(buf[i]=='\0'){
if(buf[i-1]=='3'){
printf("%d\n",i);
break;
}else{
printf("-1\n");
break;
}
}
if(buf[i]!='3'){
printf("-1\n");
break;
}
i++;
}
return 0;
}
Kakisuke