Please sign in first.
Submission #4214793
Source Code Expand
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string>
using namespace std;
int main(){
long long int k, a, b;
cin >> k >> a >> b;
long long int bis = 1, yen = 0;
long long int cnt = 0;
long long int tmp = 1;
while(true){
if(cnt == k){
break;
}
if(tmp < a){
bis++;
tmp++;
cnt++;
}
else{
tmp -= a;
bis -= a;
yen++;
cnt++;
if(cnt == k){
bis += (a + 1);
break;
}
else{
yen--;
bis += b;
if(bis < cnt + 1){
bis = cnt + 1;
}
cnt++;
}
}
}
if(bis < k + 1){
bis = k + 1;
}
cout << bis << endl;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - When I hit my pocket... |
| User | mimimi |
| Language | C++14 (GCC 5.4.1) |
| Score | 0 |
| Code Size | 965 Byte |
| Status | WA |
| Exec Time | 757 ms |
| Memory | 256 KiB |
Judge Result
| Set Name | Sample | All | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 400 | ||||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | s1.txt, s2.txt, s3.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, s1.txt, s2.txt, s3.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01.txt | WA | 757 ms | 256 KiB |
| 02.txt | WA | 512 ms | 256 KiB |
| 03.txt | WA | 435 ms | 256 KiB |
| 04.txt | WA | 526 ms | 256 KiB |
| 05.txt | AC | 1 ms | 256 KiB |
| 06.txt | AC | 583 ms | 256 KiB |
| 07.txt | AC | 583 ms | 256 KiB |
| 08.txt | AC | 649 ms | 256 KiB |
| 09.txt | AC | 147 ms | 256 KiB |
| 10.txt | AC | 148 ms | 256 KiB |
| 11.txt | AC | 147 ms | 256 KiB |
| 12.txt | AC | 650 ms | 256 KiB |
| s1.txt | AC | 1 ms | 256 KiB |
| s2.txt | AC | 1 ms | 256 KiB |
| s3.txt | WA | 205 ms | 256 KiB |