QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#358017#3178. Shattered CakePetroTarnavskyi#AC ✓221ms3708kbC++20660b2024-03-19 16:25:102024-03-19 16:25:10

Judging History

你现在查看的是最新测评结果

  • [2024-03-19 16:25:10]
  • 评测
  • 测评结果:AC
  • 用时:221ms
  • 内存:3708kb
  • [2024-03-19 16:25:10]
  • 提交

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'