• <input id="auww4"></input>
  • <input id="auww4"><acronym id="auww4"></acronym></input>
  • <input id="auww4"><u id="auww4"></u></input>
    <object id="auww4"><acronym id="auww4"></acronym></object>
    <menu id="auww4"></menu><input id="auww4"><u id="auww4"></u></input>
    <input id="auww4"><u id="auww4"></u></input>
  • F.A.Q
    Hand In Hand
    Online Acmers
    Forum | Discuss
    Statistical Charts
    Problem Archive
    Realtime Judge Status
    Authors Ranklist
     
         C/C++/Java Exams     
    ACM Steps
    Go to Job
    Contest LiveCast
    ICPC@China
    Best Coder beta
    VIP | STD Contests
    Virtual Contests
        DIY | Web-DIY beta
    Recent Contests
    Author ID 
    Password 
     Register new ID

    大哥,我的代碼你都數據都ok了,為什么還是wrong,哭了快,幫著看看

    Posted by dream at 2013-01-08 13:46:18 on Problem 1063
    (225)  


    #include<iostream>
    using namespace std;
    int find_point(char a[])
    {
    	int i;
    	for(i=0;i<6;i++)
    		if(a[i]=='.')break;
    	return i;
    }
    
    void multi(int answer[],int num,int &answer_len)
    {
    	int c=0;
    	for(int i=0;i<answer_len;i++)
    	{
    		int s=(answer[i]*num+c);
    		answer[i]=s%10;
    		c=s/10;
    	}
    	while(c)
    	{
    		answer[answer_len++]=c%10;
    		c/=10;
    	}
    }
    
    
    int main()
    {
    	int answer[150]={0};
    	int plus[10];
    	char R[10];
    	int n;
    	while(cin>>R>>n)
    	{
    		int point_locate=find_point(R);
    		int point_digit=(5-point_locate)*n;
    		int len=0;
    		for(int i=5;i>=0;i--)
    		{
    			if(R[i]!='.')
    			answer[len++]=plus[len]=R[i]-'0';
    		}
    		//cur=6  answer  5 digit;
    		if(plus[1]==0&&plus[2]==0&&plus[3]==0&&plus[4]==0&&plus[0]==0)
    		{
    			cout<<'0'<<endl;
    			continue;
    		}
    		if(n==0)
    		{
    			cout<<'1'<<endl;
    			continue;
    		}
    		for(int i=0;i<n-1;i++)
    		{
    			int num=plus[0]+plus[1]*10+plus[2]*100+plus[3]*1000+plus[4]*10000;
    			multi(answer,num,len);
    		}
    
    		
    
    		int flag;
    		flag=len-1;
    		for(;flag>=point_digit;flag--)
    			if(answer[flag])break;
    
    		for(int i=flag;i>point_digit-1;i--)
    			cout<<answer[i];
    
    		flag=0;
    		for(;;){
    			if(answer[flag])break;
    			flag++;
    		}
    
    		if(flag<point_digit)
    		     cout<<'.';
    		
    		for(int i=point_digit-1;i>=flag;i--)
    			cout<<answer[i];
    		cout<<endl;
    	}
    	return 0;
    
    }


    Post your reply here:

    Author ID
    Password
    Title
    Content  
     
    Hangzhou Dianzi University Online Judge 3.0
    Copyright © 2005-2020 HDU ACM Team. All Rights Reserved.
    Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
    Total 0.000000(s) query 4, Server time : 2020-11-09 02:27:59, Gzip enabled
    棋牌