結果
| 問題 | No.81 すべて足すだけの簡単なお仕事です。 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-30 01:54:36 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,198 bytes |
| 記録 | |
| コンパイル時間 | 1,040 ms |
| コンパイル使用メモリ | 199,672 KB |
| 最終ジャッジ日時 | 2026-07-12 23:31:42 |
| 合計ジャッジ時間 | 1,753 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:41:36: error: call of overloaded 'abs(__int128&)' is ambiguous
41 | bool minus = suma<0; suma = abs(suma);
| ~~~^~~~~~
main.cpp:41:36: note: there are 6 candidates
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/cstdlib:83,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:41,
from main.cpp:1:
/usr/include/stdlib.h:980:12: note: candidate 1: 'int abs(int)'
980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
| ^~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/cstdlib:87:
/home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/std_abs.h:85:3: note: candidate 2: 'constexpr long double std::abs(long double)'
85 | abs(long double __x)
| ^~~
/home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/std_abs.h:81:3: note: candidate 3: 'constexpr float std::abs(float)'
81 | abs(float __x)
| ^~~
/home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/std_abs.h:77:3: note: candidate 4: 'constexpr double std::abs(double)'
77 | abs(double __x)
| ^~~
/home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/std_abs.h:67:3: note: candidate 5: 'long long int std::abs(long long int)'
67 | abs(long long __x) { return __builtin_llabs (__x); }
| ^~~
/home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/std_abs.h:62:3: note: candidate 6: 'long int std::abs(long int)'
62 | abs(long __i) { return __builtin_labs(__i); }
| ^~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
template<typename T>
istream &operator>>(istream &is,vector<T> &a){
for(auto &v : a) cin >> v;
return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &a){
if(a.size() == 0) return os;
cout << a.at(0);
for(int i=1; i<a.size(); i++) cout << " " << a.at(i);
cout << "\n";
return os;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N; cin >> N;
__int128_t suma = 0;
while(N--){
string s; cin >> s;
int more = 10,dec = 0;
for(auto c : s){
if(c == '.') dec = 1;
else if(c != '-') more -= dec;
}
while(more--) s += '0';
__int128_t now = 0;
for(auto c : s) if(c != '.' && c != '-') now *= 10,now += c-'0';
if(s.at(0) == '-') now = -now;
suma += now;
}
string answer = "";
bool minus = suma<0; suma = abs(suma);
while(suma) answer += suma%10+'0',suma /= 10;
while(answer.size() < 11) answer += '0';
answer.insert(answer.begin()+10,'.');
if(minus) answer += '-';
reverse(answer.begin(),answer.end());
cout << answer << endl;
}