#29733: CPP


fangjst@gmail.com (Justin)

學校 : 不指定學校
編號 : 174892
來源 : [163.20.170.253]
最後登入時間 :
2023-12-28 10:23:10
d056. 10013 - Super long sums -- UVa10013 | From: [49.159.5.17] | 發表日期 : 2022-03-27 10:46

//以下程式碼long long存不下,請試著修改。

 

 

 

 

 

//r053.10013 - Super long sums

 

//Problem p053's Statement

 

//有個新語言 R++ 的開發者發現,不管 SuperLongInt 型態的整數上限訂到多大,程式設計師仍然會有需要處理更大的數字。即使 1000 位數的限制仍然太小… 你需要算出兩個最長為 1,000,000 位數的數字的和。

 

#include <iostream>

 

using namespace std;

 

 

 

#include<math.h>

 

int main(){

 

    long long a,b,c,d,e,h,i,s,t;

 

    cin >> a;

 

    s = 0;

 

    for( h=1 ; h<=a ; h=h+1 ){

 

      cin >> b;

 

      for( i=1 ; i<=b ; i=i+1 ){

 

        cin >> c >> d;

 

        e = (c+d)*pow(10,(b-i));

 

        s += e;

 

      }

 

      cout << s << endl;

 

      s=0;

 

    }

 

}

 
ZeroJudge Forum