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

一点高精都不用的

Posted by zrh33 at 2011-09-09 20:51:08 on Problem 1004
#include <iostream>
using namespace std;

double a[12];

int main () {
    int  ans =0;
    for (int i=0; i<12; i++) {
        cin>>a[i];
        ans += a[i]*1000;
    }
    
    ans /= 12;
    
    if (ans %10 >= 5) {
       ans /= 10;
       cout<<"$"<<ans/100<<"."<<ans%100 + 1;
    }
    
    else {
         ans /=10;
         cout<<"$"<<ans/100<<"."<<ans%100;
    }
    
    system ("pause");
    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