• <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 nonames at 2020-04-19 02:47:19 on Problem 1002
    (99)  


    #include<iostream>
    #include<stdio.h>
    #include<cstring>
    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;
    		strcpy(d,a);strcpy(e,b);
    		int len1,len2,len3,len4;
    		len1=strlen(a);
    		len2=strlen(b);
    		if(len1<len2){strcpy(c,a);strcpy(a,b);strcpy(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 = %s\n",d,e,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 4, Server time : 2020-10-16 04:10:10, Gzip enabled
    棋牌