結果
問題 | No.820 Power of Two |
ユーザー |
|
提出日時 | 2019-05-24 00:50:38 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 348 bytes |
コンパイル時間 | 208 ms |
コンパイル使用メモリ | 30,080 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-17 09:58:50 |
合計ジャッジ時間 | 761 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 WA * 6 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d %d", &n, &k); | ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <math.h> int main() { int n, k, x; x = 1; scanf("%d %d", &n, &k); /*2^k * 定数 で 2^k ~ 2^Nを求める */ /**/ /*2^k*/ if (k == 0) printf("%d\n", (int)powf(2, 30)); else if (n > k) { printf("%d\n", (n-k) * 2); } else { printf("0\n"); } return 0; }