QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#191617 | #5259. Skills in Pills | timreizin | WA | 0ms | 3624kb | C++20 | 1.1kb | 2023-09-30 03:12:02 | 2023-09-30 03:12:03 |
Judging History
answer
#include <vector>
#include <queue>
#include <list>
#include <iostream>
#include <array>
#include <string>
#include <numeric>
#include <algorithm>
#include <cmath>
using namespace std;
using ll = long long;
int main()
{
int k, j, n;
cin >> k >> j >> n;
auto findMeet = [&k, &j, &n](int cnt1, int cnt2)
{
for (int i = 0; i < n + 10; ++i)
{
++cnt1;
++cnt2;
if (cnt1 == k && cnt2 == j)
return i;
cnt1 %= k;
cnt2 %= j;
}
return n + 10;
};
if (findMeet(0, 1) < findMeet(1, 0))
swap(k, j);
int res = 0;
int cnt1 = 0, cnt2 = 0;
for (int i = 0; i < n; ++i)
{
++cnt1;
++cnt2;
if (cnt1 == j && cnt2 == k)
{
res += 2;
cnt1 = 1;
cnt2 = 0;
}
if (cnt1 == j)
{
++res;
cnt1 = 0;
}
if (cnt2 == k)
{
++res;
cnt2 = 0;
}
}
cout << res << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3620kb
input:
3 9 20
output:
8
result:
ok single line: '8'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
8 2 12
output:
7
result:
ok single line: '7'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3596kb
input:
2 5 15
output:
11
result:
wrong answer 1st lines differ - expected: '10', found: '11'