| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
这组数据结果怎么是26?3 10 2
2 1
4 1
0 0
AC代码:
#include<iostream>
#include <string.h>
#include <cstdlib>
using namespace std;
int state[2323];
int i,T,N,F,B,b,result;
inline int cmp(const void *a, const void *b)
{
return *(int *)a - *(int *)b;
}
int main()
{
cin>>T;
for (;cin>>N>>F>>B,T--;)
{
int sum=0;
for (i=0;i<N;++i)
{
cin>>state[i]>>b;
state[i]+=2*b*(F-state[i]);
}
qsort(state,N,sizeof(state[0]), cmp);
cout<<((B-1)/N)*2*F+(F+state[(B-1)%N])<<endl;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator