結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー BantakoBantako
提出日時 2017-08-11 18:29:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 846 bytes
コンパイル時間 1,496 ms
コンパイル使用メモリ 164,264 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 22:22:02
合計ジャッジ時間 3,162 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 RE -
testcase_04 AC 1 ms
5,376 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 RE -
testcase_24 RE -
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 WA -
testcase_28 AC 1 ms
5,376 KB
testcase_29 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   13 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1000000007;
ll pow(int n){
    ll ans = 1;
    for(int i = 0;i < n;i++){
        ans *= 10;
    }
    return ans;
}
main(){
    int N;
    ll usum = 0,dsum = 0;
    cin >> N;
    for(int i = 0;i < N;i++){
        int nflag = 1;
        ll a,b = 0;
        string s;
        cin >> s;
        if(s[0] == '-'){
            nflag = -1;
            s.erase(s.begin());
        }
        int index = s.find(".");
        if(index != -1){
            a = stoi(s.substr(0,index));
            b = stoi(s.substr(index+1,s.length()-index-1));
            b *= pow(11-s.length()+index);
        }else a = stoi(s);
        usum += a * nflag;
        dsum += b * nflag;
    }
    usum += dsum / pow(10);
    dsum %= pow(10);
    printf("%lld.%010lld\n",usum,dsum);
}
0