Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
看看,我也不懂,只是一写就过,水题!!In Reply To:Re:OMS的是怎么过的呀? Posted by:574394335 at 2008-07-28 17:01:30 #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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator