2015-02-01から1ヶ月間の記事一覧

0123 - Speed Skating Badge Test

#include <iostream> #include <string> using namespace std; void Slove(double s_run, double l_run) { if (s_run<35.50 && l_run<71.00) cout << "AAA" << endl; else if (s_run<37.50 && l_run<77.00) cout << "AA" << endl; else if (s_run<40.00 && l_run<83.00) cout <</string></iostream>…

0122 - Summer of Phyonkichi

#include <iostream> #include <queue> #include <string> using namespace std; const int dx[12]={2, 2, 1, 0, -1, -2, -2, -2, -1, 0, 1, 2}; const int dy[12]={0, 1, 2, 2, 2, 1, 0, -1, -2, -2, -2, -1}; struct DATA { int x, y, number; DATA(int a, int b, int c) {x=a; y=b;</string></queue></iostream>…

0121 - Seven Puzzle

#include <iostream> #include <map> #include <queue> #include <string> #include <utility> using namespace std; const int d[4]={-1, 1, -4, 4}; map<string,int> count; void bfs(void) { queue<string> que; que.push("01234567"); while ( !que.empty() ) { string wk1=que.front(); que.pop(); int pos=wk1.find</string></string,int></utility></string></queue></map></iostream>…

0118 - Property Distribution

#include <iostream> #include <string> using namespace std; int H, W; string field[100]; void dfs(int i, int j, char fruit) { field[i][j]='.'; if (j+1</string></iostream>

0117 - A reward for a Carpenter

#include <algorithm> #include <cstdio> #include <functional> #include <iostream> #include <queue> #include <vector> #include <utility> using namespace std; #define MAX_V 20 #define INF (1<<29) typedef pair<int,int> P_II; struct edge { int to, cost; edge(int a, int b) {to=a; cost=b;} }; vector<edge> …</edge></int,int></utility></vector></queue></iostream></functional></cstdio></algorithm>

0113 - Period

#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; void Slove(int p, int q) { int index=-1; vector<int> vec; map<int,int> remain; remain[p%q]=0; p*=10; for (int i=0; i<80; ++i) { vec.push_back(p/q); if ( !(p%q) ) break; else if ( rem</int,int></int></vector></string></map></iostream></algorithm>…

0112 - A Milk Shop

#include <algorithm> #include <iostream> #include <vector> using namespace std; void Slove(int n) { int wait; vector<int> vec; vec.clear(); for (int i=0; i<n; ++i) { cin >> wait; vec.push_back(wait); } sort( vec.begin(),vec.end() ); long long sum=0; for (int i=0; i</n;></int></vector></iostream></algorithm>

0108 - Operation of Frequency of Appearance

#include <algorithm> #include <iostream> using namespace std; void Slove(int n) { int P[12], S[12], min_count=0, k; for (int k=0; k<n; ++k) cin >> S[k]; while (true) { fill(P,P+12,0); for (int i=0; i</n;></iostream></algorithm>

0107 - Carry a Cheese

#include <cmath> #include <iostream> using namespace std; void Slove(double a, double b, double c) { int n; double r; cin >> n; for (int i=0; i<n; ++i) { cin >> r; if ( pow(a/2.0,2)+pow(b/2.0,2)</n;></iostream></cmath>