QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#806849#9859. King of Gamerslight_arrowTL 0ms3612kbC++11926b2024-12-09 16:08:202024-12-09 16:08:21

Judging History

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

  • [2024-12-09 16:08:21]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3612kb
  • [2024-12-09 16:08:20]
  • 提交

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...

output:


result: