結果
問題 | No.791 うし数列 |
ユーザー |
|
提出日時 | 2019-04-12 04:40:37 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 345 bytes |
コンパイル時間 | 647 ms |
コンパイル使用メモリ | 20,608 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-13 08:46:15 |
合計ジャッジ時間 | 791 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 |
コンパイルメッセージ
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++) ; if (N[i--] == '\0' && i > 0 && i <= 100) { printf("%d\n", i); exit(0); } } printf("-1\n"); }