diff options
| author | Gaspard Coulet <gaspard.coulet@mines-ales.org> | 2021-04-28 23:05:53 +0200 |
|---|---|---|
| committer | Gaspard Coulet <gaspard.coulet@mines-ales.org> | 2021-04-28 23:05:53 +0200 |
| commit | 9fe033ea88c2f705ec18c232873d056e0c229d72 (patch) | |
| tree | 0647dc8c51610c7336c88c04de2068ea14b21e17 /sem_5/codingbattle/ex2 | |
Initial commit
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;
+}
|
