diff options
Diffstat (limited to 'sem_5/codingbattle/ex2')
| -rw-r--r-- | sem_5/codingbattle/ex2/ex2 | bin | 0 -> 14359 bytes | |||
| -rw-r--r-- | sem_5/codingbattle/ex2/ex2.cpp | 32 |
2 files changed, 32 insertions, 0 deletions
diff --git a/sem_5/codingbattle/ex2/ex2 b/sem_5/codingbattle/ex2/ex2 Binary files differnew file mode 100644 index 0000000..4c64c21 --- /dev/null +++ b/sem_5/codingbattle/ex2/ex2 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;
+}
|
