結果
| 問題 |
No.411 昇順昇順ソート
|
| コンテスト | |
| ユーザー |
tekitouk
|
| 提出日時 | 2016-08-24 01:43:10 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 320 bytes |
| コンパイル時間 | 363 ms |
| コンパイル使用メモリ | 20,480 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-08 00:11:25 |
| 合計ジャッジ時間 | 1,028 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
コンパイルメッセージ
main.c:7:4: warning: conflicting types for built-in function ‘pow’; expected ‘double(double, double)’ [-Wbuiltin-declaration-mismatch]
7 | ll pow(int n);
| ^~~
main.c:2:1: note: ‘pow’ is declared in header ‘<math.h>’
1 | #include <stdio.h>
+++ |+#include <math.h>
2 |
main.c: In function ‘main’:
main.c:13:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%d %d", &N, &K);
| ^~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int N, K;
typedef long long ll;
ll pow(int n);
ll ans;
int main() {
scanf("%d %d", &N, &K);
if (K == 1) {
ans = pow(N - 1) - N;
}
else {
ans = pow(N-K);
}
printf("%lld\n", ans);
return 0;
}
ll pow(int n) {
ll r = 1;
int i;
for (i = 1; i <= n; i++) {
r *= 2;
}
return r;
}
tekitouk