| ||||||||||
| 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 | |||||||||
Re:为什么输出格式不对?请教大牛In Reply To:为什么输出格式不对?请教大牛 Posted by:pkwang at 2006-09-30 22:27:09 > #include<iostream>
> #include<string>
> using namespace std;
>
> int pows(int b,int a)
> {
> int www;
> int res = 1;
> if(a == 0)
> return 1;
> for(www = 1;www <= a; www ++)
> res*=10;
> return res;
> }
> int main()
> {
>
> string str;
> char string[100][10];
> int st[100];
> int top = -1;
> //cin.get();
> getline(cin,str);
>
>
> while(str[0] != '0')
> {
> int i;
> int top=-1,q=-1;
> int end = str.length();
> str[end] = '\n';
> for(i = 2;i < str.length();i++)
> {
> q=-1;
> if(str[i] != ' ')
> {
> string[++top][++q] = str[i];
> while(str[++i] != ' ' && str[i] != '\n')
> string[top][++q] = str[i];
> }
> string[top][++q] = '\0';
> }
> int m,n ;
> n = -1;
> for(m = 0;m <= top;m ++)
> {
> n = -1;
> while(string[m][++n]);
> st[m] = 0;
> int mm;
> for(mm = 0;mm < n; mm ++)
> st[m] += (string[m][mm]-48)*pows(10,(n - mm-1));
> }
>
> int a,b,c,d,e,f;
> for(a = 0;a <= top;a ++)
> for(b = a + 1;b <= top;b ++)
> for(c = b + 1;c <= top;c ++)
> for(d = c + 1;d <= top;d ++)
> for(e = d + 1;e <= top;e ++)
> for(f = e + 1;f <= top;f ++)
> {
> cout<<st[a]<<' '<<st[b];
> cout<<' '<<st[c]<<' ';
> cout<<st[d]<<' '<<st[e]<<' '<<st[f]<<endl;
> }
> //cout <<endl;
> getline(cin,str);
> }
>
> return 0;
> }
好像是这里: Do not put a blank line after the last test case.
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator