summaryrefslogtreecommitdiff
path: root/sem_5/codingbattle/ex2/ex2.cpp
diff options
context:
space:
mode:
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;
+}