結果

問題 No.2247 01 ZigZag
ユーザー 👑 CleyL
提出日時 2023-03-24 10:56:44
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 965 bytes
コンパイル時間 568 ms
コンパイル使用メモリ 67,272 KB
最終ジャッジ日時 2025-02-11 16:43:55
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <iostream>
using namespace std;
int main(){
int a,b,c;cin>>a>>b>>c;
int mx = min(a,b)*2;
if(mx < c || (mx == c && a == b) || (c == 0 && mx)){
cout << -1 << endl;
}else if(mx == 0){
for(int i = 0; a > i; i++)cout << "0";
for(int i = 0; b > i; i++)cout << "1";
cout << endl;
}else if(mx == c){
if(b > a){
//10101
int restb = b-(c/2);
for(int i = 1; c+1 > i; i++){
cout << (i%2);
}
for(int i = 0; restb > i; i++)cout << "1";
cout << endl;
}else{
//01010
int resta = a-(c/2);
for(int i = 0; c > i; i++){
cout << (i%2);
}
for(int i = 0; resta > i; i++)cout << "0";
cout << endl;
}
}else{
int resta = a-c/2;
int restb = b-(c+2)/2;
for(int i = 0; resta > i; i++)cout << "0";
for(int i = 1; c > i; i++)cout << (i%2);
for(int i = 0; restb >= i; i++)cout << "1";
if(c%2 == 0)cout << "0";
cout << endl;
}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0