QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#376414#6823. Coffee Overdosewjh213WA 24ms3688kbC++14569b2024-04-04 09:40:012024-04-04 09:40:01

Judging History

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

  • [2024-04-08 20:49:53]
  • hack成功,自动添加数据
  • (/hack/589)
  • [2024-04-04 09:40:01]
  • 评测
  • 测评结果:WA
  • 用时:24ms
  • 内存:3688kb
  • [2024-04-04 09:40:01]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
int cnt=0;
int T;
void solve(){
	int n,k;
	cin>>n>>k;
	if(cnt==4003)cout<<n<<" "<<k<<"\n";
	double a=-1.0/2*k,b=1.0/2*k*k,c=1.0/2*(n*n+n);
	int dui=(int)(-b/2*a+1e-9);
	dui=min(dui,n/k);
	dui=max((int)0,dui);
	int ans=a*dui*dui+b*dui+c+0.5;
	//cerr<<ans<<" ";
	int tp=(n-1)/k+1;
	//cerr<<tp<<" ";
	tp=(k*(k-1))/2*tp-tp*(tp-1)/2*k+(tp*k)*(tp*k+1)/2-(tp*k)*(tp*k-n);
	ans=max(ans,tp);
	if(T<4003)cout<<ans<<"\n";
}
signed main(){
	cin>>T;
	while(T--)cnt++,solve();
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3688kb

input:

4
1 2
2 1
10 4
172800 172800

output:

2
3
63
29859840000

result:

ok 4 tokens

Test #2:

score: -100
Wrong Answer
time: 24ms
memory: 3656kb

input:

100000
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 ...

output:

9 3
95616
95808
96000
18721
18722
18721
18657
18346
17020
16831
17185
17587
17866
18160
18337
18630
18812
18991
19105
19282
19441
19576
19711
19855
19998
20101
20257
20400
20488
20611
20776
20909
21000
21049
21217
21384
21522
21630
21708
21756
21856
22035
22200
22345
22470
22575
22660
22725
22770
22...

result:

wrong answer 1st words differ - expected: '1', found: '9'