結果
| 問題 |
No.3 ビットすごろく
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-06-16 01:02:15 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 639 bytes |
| コンパイル時間 | 233 ms |
| コンパイル使用メモリ | 29,952 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-25 03:14:49 |
| 合計ジャッジ時間 | 1,091 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 15 |
ソースコード
#include <stdio.h>
int main(void)
{
unsigned short n, position = 1, i = 1, j;
char step, check[16] = {}, count = 0;
scanf("%hd", &n);
for(; !(position == n); i++){
step = 0;
for(j = 0; j < 16; j++)
if(position & (1 << j))
step++;
if(position + step <= n)
position += step;
else if(position + step > n){
position -= step;
check[count] = step;
for(j = 0; j < 16; j++){
if(count == j)
continue;
if(check[count] == check[j]){
i = -1;
goto end;
}
}
count++;
}
}
end:;
printf("%hd\n", i);
return 0;
}