Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这组数据结果怎么是26?

Posted by ACFirst at 2010-04-30 12:59:39 on Problem 2772
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator