結果
問題 | No.201 yukicoderじゃんけん |
ユーザー |
![]() |
提出日時 | 2015-05-03 23:35:58 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 2,218 bytes |
コンパイル時間 | 1,220 ms |
コンパイル使用メモリ | 160,604 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 17:18:50 |
合計ジャッジ時間 | 1,659 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:44:5: warning: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized] 44 | if (ans == 0) cout << -1 << endl; | ^~
ソースコード
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> PII; typedef long long LL; typedef unsigned long long ULL; template<class T> inline bool amax (T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool amin (T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; } template<class T> ostream& operator << (ostream &os, const vector<T> &v) { os << "["; for (typename vector<T>::const_iterator it = v.begin(); it != v.end(); it++) { os << (it != v.begin() ? ", " : "") << *it; } os << "]"; return os; } template<class T> ostream& operator << (ostream &os, const set<T> &s) { os << "["; for (typename set<T>::const_iterator it = s.begin(); it != s.end(); it++) { os << (it != s.begin() ? ", " : "") << *it; } os << "]"; return os; } template<class Key, class Val> ostream& operator << (ostream &os, const map<Key, Val> &m) { os << "{"; for (typename map<Key, Val>::const_iterator it = m.begin(); it != m.end(); it++) { os << (it != m.begin() ? ", " : "") << it->first << ":" << it->second; } os << "}"; return os; } template<class T, class S> ostream& operator << (ostream &os, const pair<T, S> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; } template <class Target, class Source> inline Target lexical_cast (const Source &s) { Target t; stringstream ss; ss << s; ss >> t; return t; } //> v < ^ (clock wise) int dx[] = {1,0,-1,0}; int dy[] = {0,1,0,-1}; const int INFI = 1<<28; const long long int INFL = 1LL<<60; const double INFD = 1e+300; const float INFF = 1e+100; const double EPS = 1e-8; int main(){ cout.setf(ios::fixed); cout.precision(10); ios_base::sync_with_stdio(false); vector<pair<int,string>> s; string n1, n2; string s1, s2; char c; cin >> n1 >> s1 >> c; cin >> n2 >> s2 >> c; int ans; if (s1.size() == s2.size()) { if (s1 == s2) ans = 0; else if (s1 > s2) ans = 1; else if (s1 < s2) ans = -1; } else if (s1.size() > s2.size()) { ans = 1; } else if (s1.size() < s2.size()) { ans = -1; } if (ans == 0) cout << -1 << endl; else if (ans == 1) cout << n1 << endl; else if (ans == -1) cout << n2 << endl; return 0; }