結果
| 問題 | No.662 スロットマシーン |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-04 23:53:03 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 851 bytes |
| 記録 | |
| コンパイル時間 | 481 ms |
| コンパイル使用メモリ | 82,912 KB |
| 最終ジャッジ日時 | 2026-03-20 06:50:01 |
| 合計ジャッジ時間 | 824 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:13:15: error: 'uint64_t' was not declared in this scope
13 | array<uint64_t, N> cs, bs{5, 5, 5, 5, 5};
| ^~~~~~~~
main.cpp:6:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
5 | #include <map>
+++ |+#include <cstdint>
6 | #include <string>
main.cpp:13:26: error: template argument 1 is invalid
13 | array<uint64_t, N> cs, bs{5, 5, 5, 5, 5};
| ^
main.cpp:13:32: error: scalar object 'bs' requires one element in initializer
13 | array<uint64_t, N> cs, bs{5, 5, 5, 5, 5};
| ^~
main.cpp:19:31: error: invalid types 'int[int]' for array subscript
19 | cin >> s >> cs[i];
| ^
main.cpp:46:26: error: invalid types 'int[int]' for array subscript
46 | exp += cs[i] / n[0] * bs[i] / n[1];
| ^
main.cpp:52:22: error: expected ';' before 'i'
52 | for (uint64_t i : bs) {
| ^~
| ;
main.cpp:56:9: error: expected primary-expression before 'return'
56 | return 0;
| ^~~~~~
main.cpp:54:10: error: expected ';' before 'return'
54 | }
| ^
| ;
55 |
56 | return 0;
| ~~~~~~
main.cpp:56:9: error: expected primary-expression before 'return'
56 | return 0;
| ^~~~~~
main.cpp:54:10: error: expected ')' before 'return'
54 | }
| ^
| )
55 |
56 | return 0;
| ~~~~~~
main.cpp:52:13: note: to match this '('
52 | for (uint64_t i : bs) {
| ^
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <map>
#include <string>
using namespace std;
const int N = 5;
int main() {
array<uint64_t, N> cs, bs{5, 5, 5, 5, 5};
vector<int> rs[3];
map<string, int> m;
for (int i = 0; i < N; i++) {
string s;
cin >> s >> cs[i];
m[s] = i;
}
double n[3];
for (int i = 0; i < 3; i++) {
cin >> n[i];
for (int j = 0; j < n[i]; j++) {
string s;
cin >> s;
rs[i].emplace_back(m[s]);
}
}
for (int i = 0; i < 5; i++) {
int n[3];
for (int j = 0; j < 3; j++){
n[j] = count(rs[j].begin(), rs[j].end(), i);
}
for(const int& m : n){
bs[i] *= m;
};
}
double exp = 0;
for (int i = 0; i < N; i++) {
exp += cs[i] / n[0] * bs[i] / n[1];
}
exp /= n[2];
cout << exp << endl;
for (uint64_t i : bs) {
cout << i << endl;
}
return 0;
}