結果

問題 No.791 うし数列
ユーザー Maeda
提出日時 2025-03-11 11:31:31
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 248 bytes
コンパイル時間 321 ms
コンパイル使用メモリ 24,832 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-11 11:31:32
合計ジャッジ時間 1,359 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 7 WA * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:17: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[10000]’ [-Wformat=]
    5 |         scanf("%s",&numStr);
      |                ~^  ~~~~~~~
      |                 |  |
      |                 |  char (*)[10000]
      |                 char *
main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%s",&numStr);
      |         ^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void){
	char numStr[10000];
	scanf("%s",&numStr);
	int i = 1;
	if(numStr[0] != '1'){
		i = -1;
	}else{
		while(numStr[i] != '\0'){
			if(numStr[i] != '3'){
				i = -1;
				break;
			}
			i++;
		}
	}
	printf("%d",i-1);
}
0