AtCoder Beginner Contest 002(ABC002)
の私の解答です。
言語:C++11
#include <cstdio> | |
#include <math.h> | |
#include <algorithm> | |
#include <vector> | |
#include <iostream> | |
#include <sstream> | |
#include <string> | |
#include <iomanip> | |
#include <set> | |
#include <map> | |
using namespace std; | |
#define EPS 1e-14 | |
#define FOR(i,a,b) for (int i=(a);i<(b);i++) | |
#define REP(i,n) FOR(i, 0, n) | |
#define PI 2*acos(0.0) | |
#define ALL(a) (a).begin(),(a).end() | |
#define DEBUG(x) cout<<#x <<": "<< x << "\n" | |
#define DEBUG_ARR(a) REP(i, size(a)){ cout << #a << "[" << i << "]: " << a[i] << "\n"; } | |
int main() { | |
// --- I/O 高速化 --- | |
cin.tie(0); | |
ios::sync_with_stdio(false); | |
// --- ここまで --- | |
int X, Y, ans; | |
cin >> X >> Y; | |
ans = (X > Y) ? X : Y; | |
cout << ans << "\n"; | |
return 0; | |
} |
AtCoder Beginner Contest 002(ABC002)
の私の解答です。
言語:C++11
#include <cstdio> | |
#include <math.h> | |
#include <algorithm> | |
#include <vector> | |
#include <iostream> | |
#include <sstream> | |
#include <string> | |
#include <iomanip> | |
#include <set> | |
#include <map> | |
using namespace std; | |
#define EPS 1e-14 | |
#define FOR(i,a,b) for (int i=(a);i<(b);i++) | |
#define REP(i,n) FOR(i, 0, n) | |
#define PI 2*acos(0.0) | |
#define ALL(a) (a).begin(),(a).end() | |
#define DEBUG(x) cout<<#x <<": "<< x << "\n" | |
#define DEBUG_ARR(a) REP(i, size(a)){ cout << #a << "[" << i << "]: " << a[i] << "\n"; } | |
int main() { | |
// --- I/O 高速化 --- | |
cin.tie(0); | |
ios::sync_with_stdio(false); | |
// --- ここまで --- | |
string W; | |
cin >> W; | |
string ans; | |
for (auto c : W) { | |
switch (c) | |
{ | |
case 'a': | |
break; | |
case 'i': | |
break; | |
case 'u': | |
break; | |
case 'e': | |
break; | |
case 'o': | |
break; | |
default: | |
ans += c; | |
break; | |
} | |
} | |
cout << ans << "\n"; | |
return 0; | |
} |
#include <cstdio> | |
#include <math.h> | |
#include <algorithm> | |
#include <vector> | |
#include <iostream> | |
#include <sstream> | |
#include <string> | |
#include <iomanip> | |
#include <set> | |
#include <map> | |
using namespace std; | |
#define EPS 1e-14 | |
#define FOR(i,a,b) for (int i=(a);i<(b);i++) | |
#define REP(i,n) FOR(i, 0, n) | |
#define PI 2*acos(0.0) | |
#define ALL(a) (a).begin(),(a).end() | |
#define DEBUG(x) cout<<#x <<": "<< x << "\n" | |
#define DEBUG_ARR(a) REP(i, size(a)){ cout << #a << "[" << i << "]: " << a[i] << "\n"; } | |
int main() { | |
// --- I/O 高速化 --- | |
cin.tie(0); | |
ios::sync_with_stdio(false); | |
// --- ここまで --- | |
int ax, bx, cx, ay, by, cy; | |
double S = 0; | |
cin >> ax >> ay >> bx >> by >> cx >> cy; | |
bx -= ax; by -= ay; cx -= ax; cy -= ay; | |
S = abs(bx*cy - by*cx); | |
S /= 2; | |
cout << fixed << setprecision(1) << S << "\n"; | |
return 0; | |
} |
#pragma region Template | |
#include <cstdio> | |
#include <math.h> | |
#include <algorithm> | |
#include <vector> | |
#include <iostream> | |
#include <sstream> | |
#include <string> | |
#include <iomanip> | |
#include <set> | |
#include <map> | |
using namespace std; | |
#define EPS 1e-14 | |
#define FOR(i,a,b) for (int i=(a);i<(b);i++) | |
#define REP(i,n) FOR(i, 0, n) | |
#define PI 2*acos(0.0) | |
#define ALL(a) (a).begin(),(a).end() | |
#define DEBUG(x) cout<<#x <<": "<< x << "\n" | |
#define DEBUG_ARR(a) REP(i, size(a)){ cout << #a << "[" << i << "]: " << a[i] << "\n"; } | |
#pragma endregion | |
bool b[12][12] = { false }; //知り合いかどうか | |
void enter(vector<int>& group, int k) { | |
for (auto i = 0; i < group.size(); i++) { | |
if (!b[k][group[i]]) return; | |
if (group[i] == k) return; | |
} | |
group.push_back(k); | |
} | |
int main() { | |
// --- I/O 高速化 --- | |
cin.tie(0); | |
ios::sync_with_stdio(false); | |
// --- ここまで --- | |
int N = 0, M = 0, ans = 1; | |
cin >> N >> M; | |
if (M == 0) { | |
cout << "1\n"; | |
return 0; | |
} | |
for (int i = 0; i < M; i++) { | |
int x, y; | |
cin >> x >> y; | |
b[x - 1][y - 1] = b[y - 1][x - 1] = true; | |
} | |
for (int i = 0; i < N; i++) { | |
for (int j = i + 1; j < N; j++) { | |
if (b[i][j]) { | |
vector<int> group; | |
group.push_back(i); | |
group.push_back(j); | |
for (int k = 0; k < N; k++) { | |
enter(group, k); | |
} | |
ans = max(ans, (int)group.size()); | |
} | |
} | |
} | |
cout << ans << "\n"; | |
return 0; | |
} |