結果
| 問題 |
No.687 E869120 and Constructing Array 1
|
| コンテスト | |
| ユーザー |
takujitsu
|
| 提出日時 | 2018-06-06 03:59:00 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 616 bytes |
| コンパイル時間 | 521 ms |
| コンパイル使用メモリ | 66,656 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-30 10:12:31 |
| 合計ジャッジ時間 | 1,117 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 |
コンパイルメッセージ
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]
26 | }
| ^
ソースコード
#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;
}
takujitsu