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

Re:WA代码&&AC代码 不知为何。。。求解答

Posted by Cunch at 2010-04-17 18:55:04 on Problem 3085
In Reply To:WA代码&&AC代码 不知为何。。。求解答 Posted by:aa222 at 2009-11-22 09:48:51
> WA代码:
> #include <iostream>
> using namespace std;
> int main(){
>     int n;
>     cin>>n;
>     for(int i=1;i<=n;i++){
>         int cent;
>         cin>>cent;
>         cout<<i<<' '<<cent/25<<" QUARTER(S), "
>             <<(cent%=25,cent/10)<<" DIME(S), "
>             <<(cent%=10,cent/5)<<" NICKEL(S), "
>             <<(cent%=5,cent)<<" PENNY(S)\n";
>     }
> }
> 
> AC代码:
> #include <iostream>
> using namespace std;
> int main(){
>     int n;
>     cin>>n;
>     for(int i=1;i<=n;i++){
>         int cent;
>         cin>>cent;
>         cout<<i<<' '<<cent/25<<" QUARTER(S), ";
>         cent%=25;
>         cout<<cent/10<<" DIME(S), ";
>         cent%=10;
>         cout<<cent/5<<" NICKEL(S), ";
>         cent%=5;
>         cout<<cent<<" PENNY(S)\n";
>     }
> }
> 
> 请问第一个代码为何不能那样写?谢谢了。

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