summaryrefslogtreecommitdiff
path: root/sem_5/codingbattle/ex2/ex2.cpp
diff options
context:
space:
mode:
authorGaspard Coulet <gaspard.coulet@mines-ales.org>2021-04-28 23:05:53 +0200
committerGaspard Coulet <gaspard.coulet@mines-ales.org>2021-04-28 23:05:53 +0200
commit9fe033ea88c2f705ec18c232873d056e0c229d72 (patch)
tree0647dc8c51610c7336c88c04de2068ea14b21e17 /sem_5/codingbattle/ex2/ex2.cpp
Initial commit
Diffstat (limited to 'sem_5/codingbattle/ex2/ex2.cpp')
-rw-r--r--sem_5/codingbattle/ex2/ex2.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/sem_5/codingbattle/ex2/ex2.cpp b/sem_5/codingbattle/ex2/ex2.cpp
new file mode 100644
index 0000000..8ff3c08
--- /dev/null
+++ b/sem_5/codingbattle/ex2/ex2.cpp
@@ -0,0 +1,32 @@
+#include <iostream>
+#include <string>
+using namespace std;
+
+int main (int argc, char ** argv){
+ int g,n;
+ int max=0;
+ string strmax= "";
+ int tmp2;
+ cin >> g >> n;
+ string a;
+ int prixp;
+ int prix;
+ for (int i =0; i < n; i ++){
+ cin >> a >> prixp >> prix;
+ int tmp = g;
+ tmp = tmp - prix;
+ tmp = tmp/prixp;
+ if (tmp > max){
+ max=tmp;
+ strmax= a;
+ }
+ }
+ if (max == 0){
+ cout << "Impossible"<<endl;
+ }
+ else {
+ cout<<max<<endl;
+ cout<<strmax;
+ }
+return 0;
+}