#include using namespace std; int num[] = { 0,0,0,0 }; paircheck() { cout << num[0] << " " << num[1] << " " << num[2] << " " << num[3] << endl; pairret; cin >> ret.first >> ret.second; if( ret.first == 4 && ret.second == 0 ) { exit; } return ret; } int main() { for( size_t j = 0; j < 4; j++ ) { pair memo; int ansnum = 0; for( size_t i = 0; i < 10; i++ ) { num[j] = i; auto xx = check(); if( memo.first + memo.second < xx.first + xx.second || memo.first < xx.first ) { memo = xx; ansnum = i; } } num[j]=ansnum; } }