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 jecopeng at 2006-09-10 15:57:57 on Problem 2998
#include <iostream>
#include <string>
using namespace std;
int main(){
	int n;
	cin>>n;
	int i,j;
	for(i=0;i<n;i++){
		char streetname[100];
		cin>>streetname[0];
		for(j=1;streetname[j-1]!='\n';j++)
			streetname[j]=getchar();
		streetname[j-1]='\0';
		int sum;
		cin>>sum;
		string str;
		cin>>str;
		char contrl;
		cin>>contrl;
		int count=0;
		int temp;
		int min,max,step;
		int digit[10]={0,0,0,0,0,0,0,0,0,0};
		for(;count!=sum;){
			if(contrl=='+'){
				cin>>min>>max>>step;
				for(;min<=max;min+=step){
					count++;
					temp=min;
					while(temp>=10){
						digit[temp%10]++;
						temp/=10;
					}
					digit[temp]++;
				}
			}
			else{
				cin>>min;
				temp=min;
				while(temp>=10){
					digit[temp%10]++;
					temp/=10;
				}
				digit[temp]++;
				digit[contrl-'0']++;
				count++;
			}
			if(count==sum)	break;
			cin>>contrl;
		}
		cout<<streetname<<endl;
		cout<<sum<<' '<<str<<endl;
		for(j=0;j<10;j++)
			cout<<"Make "<<digit[j]<<" digit "<<j<<endl;
		cout<<"In total "<<digit[0]+digit[1]+digit[2]+digit[3]+digit[4]+digit[5]+digit[6]+digit[7]+digit[8]+digit[9]<<" digits"<<endl;
	}
	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