Last active
August 29, 2015 14:19
-
-
Save yukpiz/c9bcec9c6945417d39fc to your computer and use it in GitHub Desktop.
"ball" problem code of paiza.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* [Compile] | |
* g++ -std=c++11 ball.cpp -o ball | |
*/ | |
#include <vector> | |
#include <iostream> | |
using namespace std; | |
int default_input( | |
int &diameter, | |
vector< vector<int> > &sizes) | |
{ | |
int count; | |
cin >> count >> diameter; | |
diameter *= 2; | |
for (int i = 0; i < count; i++) { | |
int h, w, d; | |
cin >> h >> w >> d; | |
sizes.push_back({h, w, d}); | |
} | |
} | |
int main( | |
int arg, | |
char **args) | |
{ | |
vector < vector<int> > sizes; | |
int diameter; | |
default_input(diameter, sizes); | |
for (int i = 0; i < sizes.size(); i++) { | |
int h = sizes[i][0]; | |
int w = sizes[i][1]; | |
int d = sizes[i][2]; | |
bool breakflg = h < diameter|| w < diameter || d < diameter ? true : false; | |
if (!breakflg) { | |
cout << i + 1 << endl; | |
} | |
} | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment