結果

問題 No.415 ぴょん
ユーザー yoshikiriyoshikiri
提出日時 2016-10-03 18:48:36
言語 C90
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 362 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 21,376 KB
実行使用メモリ 782,844 KB
最終ジャッジ日時 2024-05-01 11:21:00
合計ジャッジ時間 4,561 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
13,752 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 MLE -
testcase_04 MLE -
testcase_05 MLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d %d",&n,&d);
      |         ^~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>

int main(void){
	int i,n,d,now=0,cnt=0;
	scanf("%d %d",&n,&d);

	
	int* flag;
	flag = (int*)malloc(sizeof(int)*n);
	for(i=1;i<n;i++) flag[i] = 0;
	flag[0] = 1;

	while(1){
		if(n-1-now >= d) now += d;
		else now = d-n+now;

		if(flag[now] == 0) flag[now] = 1;
		else break;

		cnt++;
	}

	printf("%d\n",cnt);

	return 0;

}
0