• <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:AC代碼,C++精簡

    Posted by fjnuThomas at 2020-07-15 22:58:15 on Problem 1002
    (94)  


    代碼如下:
    #include<iostream>
    #include<stdio.h>
    int main(){
    	using namespace std;
    	int t,s=1,i;
    	cin>>t;
    	while(t--){
    		char a[1000],b[1000],c[1000],d[1000],e[1000];
    		cin>>a>>b;
    		strcp(d,a);strcp(e,b);
    		int len1,len2,len3,len4;
    		len1=strlen(a);
    		len2=strlen(b);
    		if(len1<len2){strcp(c,a);strcp(a,b);strcp(b,c);}//a是更長數
    		len3=len1<len2?len1:len2;
    		len4=len1>len2?len1:len2;
    		for(i=0;i<len3;i++){
    			a[len4-1-i]=a[len4-1-i]+b[len3-1-i]-'0';//字符型要減去'0'
    			if(a[len4-1-i]>'9'){//字符比較    或者是a[len4-1-i]-'0'>9
    			a[len4-2-i]++;
    			a[len4-1-i]-=10;
    			}	
    		}   
    		printf("Case %d:n",s++);
    		printf("%s + %s = %sn",d,f,a);
    		if(t!=0)printf("n");
    	}
    	return 0;
    	}

    Followed by:


    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.015600(s) query 5, Server time : 2020-10-14 08:58:32, Gzip enabled
    棋牌