aboutsummaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2019-05-29 16:00:04 +0200
committerInigoGutierrez <inigogf.95@gmail.com>2019-05-29 16:00:04 +0200
commitc21c8f3d3a9cc24fe62e737630b697c568435cf2 (patch)
tree51a5a67778d8da3629fa3bf9cca2a19aa44f342b /c
parent4ef1833c653112986d01d1d453fd67a2fbb21216 (diff)
downloadAceptaElReto-c21c8f3d3a9cc24fe62e737630b697c568435cf2.tar.gz
AceptaElReto-c21c8f3d3a9cc24fe62e737630b697c568435cf2.zip
Resuelto 480 en c++: Cuántas pido.
Diffstat (limited to 'c')
-rw-r--r--c/las12uvas/480_cuantasPido.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/c/las12uvas/480_cuantasPido.cpp b/c/las12uvas/480_cuantasPido.cpp
new file mode 100644
index 0000000..2b1ed03
--- /dev/null
+++ b/c/las12uvas/480_cuantasPido.cpp
@@ -0,0 +1,16 @@
+#include <iostream>
+
+using namespace std;
+
+int main() {
+ int cases;
+ int grapes, bad, group;
+ cin >> cases;
+ for (int i = 0; i < cases; i++) {
+ cin >> grapes;
+ cin >> bad;
+ cin >> group;
+ //cout << "Grapes/group case " << i << ": " << grapes/group << endl;
+ cout << (grapes/group)*bad + min(grapes%group, bad) << endl;
+ }
+}