結果
問題 | No.112 ややこしい鶴亀算 |
ユーザー |
![]() |
提出日時 | 2014-12-23 23:48:01 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 447 bytes |
コンパイル時間 | 522 ms |
コンパイル使用メモリ | 52,696 KB |
最終ジャッジ日時 | 2024-11-14 18:57:36 |
合計ジャッジ時間 | 1,132 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:8:5: error: ‘vector’ was not declared in this scope 8 | vector<int> a(n); for(int& v: a) cin>>v; | ^~~~~~ main.cpp:3:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? 2 | #include <algorithm> +++ |+#include <vector> 3 | using namespace std; main.cpp:8:12: error: expected primary-expression before ‘int’ 8 | vector<int> a(n); for(int& v: a) cin>>v; | ^~~ main.cpp:8:35: error: ‘a’ was not declared in this scope 8 | vector<int> a(n); for(int& v: a) cin>>v; | ^ main.cpp:9:16: error: ‘a’ was not declared in this scope 9 | sort(begin(a), end(a)); | ^ main.cpp:13:16: error: expected primary-expression before ‘int’ 13 | vector<int> b; | ^~~ main.cpp:14:30: error: ‘b’ was not declared in this scope 14 | for(int i=0;i<t;++i) b.push_back(s-4); | ^ main.cpp:15:30: error: ‘b’ was not declared in this scope 15 | for(int i=0;i<c;++i) b.push_back(s-2); | ^ main.cpp:16:16: error: ‘b’ was not declared in this scope 16 | if (a==b) { | ^
ソースコード
#include <iostream> #include <algorithm> using namespace std; int main() { int n; cin>>n; vector<int> a(n); for(int& v: a) cin>>v; sort(begin(a), end(a)); for(int t=0;t<=n;++t) { int c=n-t; int s=2*c+4*t; vector<int> b; for(int i=0;i<t;++i) b.push_back(s-4); for(int i=0;i<c;++i) b.push_back(s-2); if (a==b) { cout<<c<<' '<<t<<endl; break; } } }