QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#100016 | #5678. Busy As a Bee | Nicolas125841 | AC ✓ | 2ms | 3524kb | C++14 | 484b | 2023-04-24 13:35:36 | 2023-04-24 13:35:37 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll n, m;
cin >> m >> n;
ll oddr = 2ll * m;
ll ever = 2ll * m - 2ll;
ll bound = (n % 2ll == 0ll ? ever : oddr) + oddr * n + n + 1ll;
//cout << bound << "\n";
ll odds = m-1ll;
ll eves = m-2ll;
ll segs = eves * (n/2ll) + odds * ((n + 1ll)/2ll) + n - 1ll;
//cout << segs << "\n";
cout << (1ll + bound + (segs-1ll)/2ll) << "\n";
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3524kb
input:
2 1
output:
11
result:
ok single line: '11'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3428kb
input:
3 3
output:
32
result:
ok single line: '32'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3472kb
input:
2 2
output:
14
result:
ok single line: '14'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3364kb
input:
1000000 1000000
output:
2500002749999
result:
ok single line: '2500002749999'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3420kb
input:
2 1000000
output:
5750003
result:
ok single line: '5750003'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3412kb
input:
1000000 1
output:
4500002
result:
ok single line: '4500002'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3408kb
input:
64 64
output:
10415
result:
ok single line: '10415'
Test #8:
score: 0
Accepted
time: 2ms
memory: 3524kb
input:
2 64
output:
371
result:
ok single line: '371'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3292kb
input:
64 2
output:
448
result:
ok single line: '448'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3296kb
input:
3 3
output:
32
result:
ok single line: '32'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3372kb
input:
100 50
output:
12736
result:
ok single line: '12736'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3312kb
input:
50000 25000
output:
3125118749
result:
ok single line: '3125118749'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3348kb
input:
25000 50000
output:
3125087499
result:
ok single line: '3125087499'
Test #14:
score: 0
Accepted
time: 2ms
memory: 3336kb
input:
2017 2023
output:
10206530
result:
ok single line: '10206530'
Test #15:
score: 0
Accepted
time: 2ms
memory: 3412kb
input:
2 2023
output:
11637
result:
ok single line: '11637'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3292kb
input:
2023 1
output:
9105
result:
ok single line: '9105'
Test #17:
score: 0
Accepted
time: 2ms
memory: 3416kb
input:
2023 101
output:
514930
result:
ok single line: '514930'
Test #18:
score: 0
Accepted
time: 2ms
memory: 3312kb
input:
12348 5554
output:
171480840
result:
ok single line: '171480840'