Adding easy puzzles

This commit is contained in:
Xavier Morel
2017-04-06 15:55:57 +02:00
parent 2df5dcf1e3
commit 50a3316969
19 changed files with 849 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
// https://www.codingame.com/ide/puzzle/onboarding
// Xavier Morel - 2016-03-04
#include <iostream>
using namespace std;
int main()
{
// game loop
while (1) {
string enemy1; // name of enemy 1
cin >> enemy1; cin.ignore();
int dist1; // distance to enemy 1
cin >> dist1; cin.ignore();
string enemy2; // name of enemy 2
cin >> enemy2; cin.ignore();
int dist2; // distance to enemy 2
cin >> dist2; cin.ignore();
// Write an action using cout. DON'T FORGET THE "<< endl"
if (dist1 < dist2) {
cout << enemy1 << endl;
} else {
cout << enemy2 << endl;
}
// Enter the code here
}
}