結果
問題 |
No.354 メルセンヌ素数
|
ユーザー |
|
提出日時 | 2018-03-24 05:41:55 |
言語 | C (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 382 bytes |
コンパイル時間 | 1,166 ms |
コンパイル使用メモリ | 28,672 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-06-25 02:42:12 |
合計ジャッジ時間 | 3,501 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 2 TLE * 1 -- * 10 |
ソースコード
#include<stdio.h> int main(int argc, char const *argv[]) { int p; int a=1; int binary = 0; int base = 1; int count=0; scanf("%d",&p); for (int i = 0; i < p; ++i) { a=a*2; } a-=1; // 10進数を2進数に変換 while(a>0){ binary = binary + ( a % 2 ) * base; a = a / 2; base = base * 10; count++; } printf("%d\n",count); return 0; }