QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#358017 | #3178. Shattered Cake | PetroTarnavskyi# | AC ✓ | 221ms | 3708kb | C++20 | 660b | 2024-03-19 16:25:10 | 2024-03-19 16:25:10 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int w;
cin >> w;
int n;
cin >> n;
LL s = 0;
FOR (i, 0, n)
{
int a, b;
cin >> a >> b;
s += (LL)a * b;
}
assert(s % w == 0);
cout << s / w << '\n';
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3572kb
input:
4 7 2 3 1 4 1 2 1 2 2 2 2 2 2 1
output:
6
result:
ok single line: '6'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
5 35 2 1 2 5 1 1 1 3 2 5 1 3 2 3 1 2 1 1 2 1 1 3 1 1 1 2 1 1 2 1 2 3 1 1 1 2 2 3 1 1 2 5 2 1 1 1 1 1 2 5 2 3 2 1 1 2 1 1 1 3 1 2 1 3 2 5 1 1 2 3
output:
25
result:
ok single line: '25'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
3 18 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
output:
6
result:
ok single line: '6'
Test #4:
score: 0
Accepted
time: 65ms
memory: 3624kb
input:
500 1292900 1 3 2 5 2 1 1 3 2 3 1 1 2 3 2 5 1 1 1 3 1 2 2 3 1 1 2 1 2 3 2 3 1 2 1 1 1 1 2 5 1 1 2 5 1 2 2 3 2 3 1 1 1 2 1 1 2 1 2 3 2 3 2 1 1 2 1 1 2 3 2 5 2 1 2 5 1 1 1 1 2 1 2 5 1 3 1 2 1 1 1 3 1 1 1 3 1 1 1 2 1 2 1 3 2 3 1 1 2 3 1 3 2 5 2 5 1 2 1 3 2 3 1 1 1 3 1 1 1 1 1 2 1 3 2 5 1 2 2 1 1 1 2 1 ...
output:
9235
result:
ok single line: '9235'
Test #5:
score: 0
Accepted
time: 221ms
memory: 3636kb
input:
7345 4421690 1 2 1 3 2 3 1 1 1 1 2 1 2 5 1 2 1 3 2 3 1 1 1 1 2 1 2 5 1 2 1 3 2 3 1 1 1 1 2 1 2 5 1 2 1 3 2 3 1 1 1 1 2 1 2 5 1 2 1 3 2 3 1 1 1 1 2 1 2 5 1 2 1 3 2 3 1 1 1 1 2 1 2 5 1 2 1 3 2 3 1 1 1 1 2 1 2 5 1 2 1 3 2 3 1 1 1 1 2 1 2 5 1 2 1 3 2 3 1 1 1 1 2 1 2 5 1 2 1 3 2 3 1 1 1 1 2 1 2 5 1 2 1 3...
output:
2150
result:
ok single line: '2150'