• <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

    Re:C語言寫的,類似于擺豎式解決

    Posted by XIEACM at 2018-05-03 23:41:14 on Problem 1042
    (20)  


    #include<stdio.h>
    #define maxn 40000
    
    int main()
    {
    	int n;
    	while(scanf("%d",&n)!=EOF)
    	{
    		int count=1;
    		int a[maxn]={0};
    		a[0]=1;
    		for(int i=1;i<=n;i++)
    		{
    			for(int j=0;j<count;j++)    //逐位相乘 
    				a[j]*=i;
    			for(int j=0;j<count;j++)    //進位處理 
    			{
    				if(a[j]>9)
    				{
    					a[j+1]+=a[j]/10;
    					a[j]%=10;
    					if(j==count-1)     //若最高位產生進位,則位數加 1 
    						count++;
    				}	
    			}
    		}
    		for(int i=count-1;i>=0;--i)
    			printf("%d",a[i]);
    		printf("\n");
    	}
    	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:32:16, Gzip enabled
    棋牌