結果
| 問題 |
No.791 うし数列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-04-12 04:39:24 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 382 bytes |
| コンパイル時間 | 484 ms |
| コンパイル使用メモリ | 21,120 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-13 08:42:08 |
| 合計ジャッジ時間 | 1,019 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | AC * 3 WA * 12 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:5: warning: ignoring return value of ‘scanf’ 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 = 1; N[i] == '3'; i++)
;
printf("%d, %c\n", i, N[i]);
if (N[i--] == '\0' && i > 0 && i <= 100) {
printf("%d\n", i);
exit(0);
}
}
printf("-1\n");
}