标签:
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int LL;
const int M = 100009,INF = 0x3fffffff;
int main(void) {
//problem: , address:
int n, x, y = INF;
cin >> n;
while (n--) {
cin >> x;
if (x < y) swap(x, y);
}
if(y <= 1) cout << "-1" << endl;
else cout << "1" << endl;
return 0;
}
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int LL;
const int M = 100009,INF = 0x3fffffff;
int main(void) {
int a1, a2, a3, b1, b2, b3;
cin >> a1 >> b1 >> a2 >> b2 >> a3 >> b3;
int x = a1 - a2, y = b1 - b2;
bool ans = false;
if ( (b2 <= b1 && x >= a3 && b3 <= b1) || (x >= 0 && a3 <= a1 && b3 <= y) || (y >= 0 && x >= b3 && a3 <= b1) || (x >= 0 && b3 <= a1 && a3 <= y) ) ans =true;
x = a1 - b2;
y = b1 - a2;
if ( (y >= 0 && x >= a3 && b3 <= b1) || (x >= 0 && a3 <= a1 && b3 <= y) || (y >= 0 && x >= b3 && a3 <= b1) || (x >= 0 && b3 <= a1 && a3 <= y) ) ans =true;
if (ans) cout << "YES" << endl;
else cout << "NO" << endl;
return 0;
}
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int LL;
const int M = 100009,INF = 0x3fffffff;
double pi = sqrt(3), eps = 1e-3;
int main(void) {
double sum = 0, a, b, c, d, e, f;
cin >> a >> b >> c >> d >> e >> f;
double x = sqrt((a * a) + (b * b) + a * b);
double y = sqrt((c * c) + (d * d) + c * d);
double z = sqrt((e * e) + (f * f) + e * f);
double s = (x + y + z) / 2;
//cout << x << " " << y << " "<< z << endl;
sum += sqrt(s * (s - x) * (s - y) * (s - z));
//cout << sum << endl;
sum += 0.25 * pi * (a * b + c * d + e * f);
cout << int(sum / ( pi / 4) + eps) << endl;
return 0;
}
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int LL;
const int M = 100009,INF = 0x3fffffff;
bool same(string a, string b) {
int A[26], B[26];
memset(A, 0, sizeof(A));
memset(B, 0, sizeof(B));
for (int i = 0; i < a.size(); i++) {
A[a[i] - ‘a‘]++;
B[b[i] - ‘a‘]++;
}
for (int i = 0; i < 26; i++) {
if (A[i] != B[i]) return false;
}
if (a == b) return true;
if (a.size() % 2 != 0) return false;
string x1, x2, y1, y2;
for (int i = 0; i < a.size() / 2; i++) {
x1 += a[i];
x2 += b[i];
y1 += a[i + a.size() / 2];
y2 += b[i + a.size() / 2];
}
return (same(x1, x2) && same(y1, y2)) || (same(x1, y2) && same(y1, x2));
}
int main(void) {
ios::sync_with_stdio(false);
string a, b;
while (cin >> a >> b) {
if (same(a, b)) cout << "YES" << endl;
else cout << "NO" << endl;
}
return 0;
}
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int LL;
const int M = 100009,INF = 0x3fffffff;
bool str (char a[], char b[], int n) {
bool ans = true;
for (int i = 0; i < n; i++) {
if (a[i] != b[i]) {
ans = false;
break;
}
}
return !ans;
}
bool same(char a[], char b[], int n) {
int A[26], B[26];
memset(A, 0, sizeof(A));
memset(B, 0, sizeof(B));
for (int i = 0; i < n; i++) {
A[a[i] - ‘a‘]++;
B[b[i] - ‘a‘]++;
}
for (int i = 0; i < 26; i++) if (A[i] != B[i]) return false;
if (!str(a, b, n)) return true;
if (n % 2 != 0) return false;
return (same(a, b + n / 2, n / 2) && same(a + n / 2, b, n / 2)) || (same(a, b, n / 2) && same(a + n / 2, b + n / 2, n / 2));
}
int main(void) {
ios::sync_with_stdio(false);
char a[200009], b[200009];
while (cin >> a >> b) {
int n = strlen(a);
if (same(a, b, n)) cout << "YES" << endl;
else cout << "NO" << endl;
}
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
Codeforces Round #313 (Div. 2) 解题报告
标签:
原文地址:http://blog.csdn.net/jibancanyang/article/details/47016143