結果
| 問題 |
No.791 うし数列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-04-12 04:31:40 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 342 bytes |
| コンパイル時間 | 291 ms |
| コンパイル使用メモリ | 24,064 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-13 07:11:55 |
| 合計ジャッジ時間 | 982 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 8 WA * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%s", N);
| ~~~~~^~~~~~~~~
ソースコード
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char N[102+1];
scanf("%s", N);
if (N[0] == '1') {
int i;
for (i = 0; N[++i] == '3'; )
;
if (i > 1 && i <= 100 && N[i] == '\0') {
printf("%d\n", i);
exit(0);
}
}
printf("-1\n");
}