QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#806849 | #9859. King of Gamers | light_arrow | TL | 0ms | 3612kb | C++11 | 926b | 2024-12-09 16:08:20 | 2024-12-09 16:08:21 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std ;
#define pii pair<int,int>
#define x first
#define y second
using ll = long long ;
using ull = unsigned long long ;
const int MAXN = 0x3f3f3f3f ;
const ull base = 131 ;
void solve(){
ll n , a , b ;
cin >> n >> a >> b ;
if(n % b == 0){cout << n*a/b << '\n' ; return ; }
ll tmp = n%b ;
int win_rou = 0 , all_rou = 0 ;
for(int i = 1 ; i <= tmp ; ++ i ){
if(i == 1){
win_rou++;
all_rou++;
//cout << " i : " << i << '\n' ;
continue ;
}
if(win_rou*b <= all_rou*a){
win_rou++;
all_rou++;
//cout << " i : " << i << '\n' ;
}else{
all_rou++;
}
}
ll ans = n / b * a ;
ans += win_rou ;
//cout << win_rou << ' ' << all_rou << '\n' ;
cout << ans << '\n' ;
return ;
}
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int T = 1 ;
cin >> T ;
while(T--){
solve();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3612kb
input:
3 4 3 5 8 7 10 1 1 3
output:
2 5 1
result:
ok 3 number(s): "2 5 1"
Test #2:
score: -100
Time Limit Exceeded
input:
100000 666977257 46322301 444651505 775037696 10955843 81788929 943459623 1 500000071 998998627 85 465525978 998969116 949398518 949398594 999995971 172077240 464085681 406334061 103283849 270889374 919331712 241327022 645922817 892656218 7 576716801 999547883 26 713779916 998450133 108731744 108731...