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

Empirical tests show iostream objects are several times slower than stdio functions on our system.

Posted by frkstyc at 2007-03-06 21:12:30 on Problem 2654
In Reply To:1. why Huge input,scanf is recommended.? Posted by:hasan83 at 2007-03-06 18:44:29
> 2.what the hell with the time limit thing.
> #include<iostream>
> #include<iomanip>
> #include<string>
> using namespace std;
> int main()
> {
>     string m1,m2;
>     int n,k,x=0,pp[3],limit,d[7]={1,0,0,2,1,1,0};
>     pp[2]=101;
>     while(cin>>n)
>     {
>        if(n==0)break;
>        if(x)cout<<endl;
>        x=1;
>        cin>>k;
>        int p[101]={0},w[101]={0};
>        limit=k*((n*(n-1))/2);
>        for(int i=0;i<limit;i++)
>        {
>           cin>>pp[0]>>m1>>pp[1]>>m2;
>           w[pp[d[m1[0]-m2[0]+3]]-1]++;
>           p[pp[d[m1[0]-m2[0]+3]]-1]++;
>           p[pp[d[m2[0]-m1[0]+3]]-1]++;
>        }      
>        for(int i=0;i<n;i++)
>        {
>            if(p[i]==0){cout<<"-"<<endl;continue;}    
>            cout<<fixed<<setprecision(3)<<float(w[i])/p[i]<<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