結果
| 問題 |
No.389 ロジックパズルの組み合わせ
|
| コンテスト | |
| ユーザー |
yoshinari1110
|
| 提出日時 | 2016-07-08 22:58:40 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 470 bytes |
| コンパイル時間 | 187 ms |
| コンパイル使用メモリ | 24,064 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-13 06:25:27 |
| 合計ジャッジ時間 | 2,426 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 99 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:25: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
8 | while ((scanf("%d", &h[i])) == '\n')i++;
| ~^ ~~~~~
| | |
| | long long int*
| int*
| %lld
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%lld", &m);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include <cstdio>
int main() {
long long int m;
scanf("%lld", &m);
long long int *h = new long long int[m];
int i = 0;
while ((scanf("%d", &h[i])) == '\n')i++;
int num = m - i;
num -= i;
if (num < 0) {
printf("NA\n");
}
else if (num == 0) {
printf("1\n");
}
else {
int fact1 = 1, fact2 = 1;
for (int j = 1; j <= num + i; j++) {
fact1 *= j;
}
for (int j = 1; j <= i; j++) {
fact2 *= j;
}
printf("%d\n", fact1 / fact2);
}
return 0;
}
yoshinari1110