結果

問題 No.687 E869120 and Constructing Array 1
ユーザー takujitsutakujitsu
提出日時 2018-06-06 03:59:00
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 616 bytes
コンパイル時間 512 ms
コンパイル使用メモリ 67,312 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 22:40:38
合計ジャッジ時間 1,203 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In member function ‘std::tuple<int, int> Div::calc(int)’:
main.cpp:26:5: warning: control reaches end of non-void function [-Wreturn-type]
     }
     ^

ソースコード

diff #

#include<vector>
#include<iostream>
#include<algorithm>
#include<tuple>
using namespace std;

class Div
{
public:
    int a1,a2;
    tuple<int,int> calc(int n){
        for(int i=1;i<=10;i++){
        a1=i;
        a2=n-a1;
        if((a1<=10)&&(a2<=10)){
            return forward_as_tuple(a1,a2);
            break;

        }
        else{
            continue;
        
        }
        return forward_as_tuple(-1,-1);
    }
    }
    

};
void solve(){
    Div div;
    int n,ans1,ans2;
    cin>>n;
    tie(ans1,ans2)=div.calc(n);

    cout<<ans1<<" "<<ans2<<endl;
}

int main(){
    solve();
    return 0;
}
0