結果

問題 No.1992 Tendon Walk
ユーザー Maeda
提出日時 2025-03-17 11:04:08
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 298 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 24,832 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-17 11:04:09
合計ジャッジ時間 1,250 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%d",&x);
      |         ^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
void main(void){
	int numList[] = {2,2,-1,-1,2,-1,-1};
	int x;
	scanf("%d",&x);
	
	int i = 0 , ans = 0 , count = 0;
	while(ans != x){
		ans += numList[i];
		if(numList[i] == -1){
			count++;
		}else{
			count += 2;
		}
		i++;
		if(i == 7){
			i = 0;
		}
	}
	printf("%d",count);
}
0