結果
問題 | No.412 花火大会 |
ユーザー |
![]() |
提出日時 | 2016-08-13 00:04:10 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 596 bytes |
コンパイル時間 | 206 ms |
コンパイル使用メモリ | 22,912 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 16:35:28 |
合計ジャッジ時間 | 899 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 18 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:15:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%d%d%d%d", &b, &c, &d, &n); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:16:43: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | for(int i = 0; i < n; i++) { scanf("%d", &e[i]); } | ~~~~~^~~~~~~~~~~~~
ソースコード
#include <stdio.h> int n, b, c, d, e[100]; int x, y, z; void swap(int &x, int &y) { int temp = x; x = y; y = temp; return; } int main() { scanf("%d%d%d%d", &b, &c, &d, &n); for(int i = 0; i < n; i++) { scanf("%d", &e[i]); } if(c > d) { swap(c, d); } if(b > c) { swap(b, c); } if(c > d) { swap(c, d); } for(int i = 0; i < n; i++) { if(d <= e[i]) { z++; } else if(c <= e[i]) { y++; } else if(b <= e[i]) { x++; } } int ans = (1 << n) - (1 << (n - z)) - (1 << (n - z - y)) * z - (1 << (n - z - y - x)) * (z * (z - 1) / 2 + z * y); printf("%d\n", ans); return 0; }