Skip to content

Instantly share code, notes, and snippets.

@oyakodon
Created May 7, 2016 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oyakodon/dd7fe6f8ccc2aee1559d0a0f84b3e2ea to your computer and use it in GitHub Desktop.
Save oyakodon/dd7fe6f8ccc2aee1559d0a0f84b3e2ea to your computer and use it in GitHub Desktop.
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;
}
#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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment