結果
問題 |
No.441 和か積
|
ユーザー |
![]() |
提出日時 | 2016-11-15 13:12:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,045 bytes |
コンパイル時間 | 1,468 ms |
コンパイル使用メモリ | 167,788 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-27 03:35:04 |
合計ジャッジ時間 | 2,371 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; struct Initializer { Initializer() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(15); } } initializer; template<typename T = long long> inline T toInteger(const string&); template<> inline int toInteger<int>(const string& s) { return stoi(s); } template<> inline long toInteger<long>(const string& s) { return stol(s); } template<> inline long long toInteger<long long>(const string& s) { return stoll(s); } template<typename T = long long> inline T toInteger(const string& s, int n) { T res = 0; for (char c : s) { if (isdigit(c)) res = res * n + c - '0'; else if (isalpha(c)) res = res * n + tolower(c) - 'a' + 10; } return s[0] == '-' ? -res : res; } int main() { string a, b; cin >> a >> b; int x = (a.size() > 1 ? 10 : toInteger<int>(a)); int y = (b.size() > 1 ? 10 : toInteger<int>(b)); if (x + y > x * y) cout << "S" << endl; if (x + y < x * y) cout << "P" << endl; if (x + y == x * y) cout << "E" << endl; }