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:看看,我也不懂,只是一写就过,水题!!

Posted by wxdlut at 2008-10-30 23:38:58 on Problem 1218
In Reply To:看看,我也不懂,只是一写就过,水题!! Posted by:574394335 at 2008-07-28 17:02:40
> #include <iostream>
> #include <cstdlib>
> using namespace std;
> int main()
> {
>     int a[9]={4,9,16,25,36,49,64,81,100};
>     int b[9]={2,3,4,5,6,7,8,9,10};
>     int t,k,j,max;
>     cin>>t;
>     while(t)
>     {
>             cin>>k;   j=0;
>             for(int i=0;i<9;++i)
>             {
>                     if(k==a[i])
>                     {
>                       j=i;
>                       break;
>                       }
>                      if(k<a[i])
>                      {
>                        j=i-1;
>                        break;
>                        }
>             }
>             cout<<b[j]<<endl;
>             t--;   
>     }
>     system("pause");
> }                       

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