本文主要是介绍Codeforces Round #739 (Div. 3),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
A. Dislike of Threes
B. Who's Opposite?
#include<bits/stdc++.h>
using namespace std;
int t, a, b, c;
int main() {
cin >> t;
for(int i = 1; i <= t; i++) {
cin >> a >> b >> c;
int d = max(a, b) - min(a, b);
if(a > 2 * d || b > 2 * d || c > 2 * d) cout << "-1" << endl;
else if(c > d && c <= d * 2) cout << c - d << endl;
else if (c + d <= d * 2) cout << c + d << endl;
else cout << "-1" << endl;
}
return 0;
}
C. Infinity Table
#include<bits/stdc++.h>
using namespace std;
int t, k;
void deal(int x) {
int i;
for(i = 1; i <= 100000; i++)
if(i * i >= x) break;
int tmp = i * i;
int temp = i * i - i + 1;
if(x >= temp) cout << i << " " << tmp - x + 1 << endl;
else cout << i - temp + x << " " << i << endl;
}
int main() {
cin >> t;
for(int i = 1; i <= t; i++) {
cin >> k;
deal(k);
}
return 0;
}
这篇关于Codeforces Round #739 (Div. 3)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!