diff options
| -rw-r--r-- | 12992/huatuo.c | 12 | ||||
| -rw-r--r-- | 12992/huatuo.in | 101 | ||||
| -rw-r--r-- | 591/bricks.c | 23 | ||||
| -rw-r--r-- | 591/bricks.in | 3 |
4 files changed, 139 insertions, 0 deletions
diff --git a/12992/huatuo.c b/12992/huatuo.c new file mode 100644 index 0000000..58d4ea3 --- /dev/null +++ b/12992/huatuo.c @@ -0,0 +1,12 @@ +#include <stdio.h> + +int main(){ + int n, j=0; + scanf("%d", &n); + while(n--){ + j++; + int b; + scanf("%d", &b); + printf("Case #%d: %d\n", j, b*2-1); + } +} diff --git a/12992/huatuo.in b/12992/huatuo.in new file mode 100644 index 0000000..2c842b0 --- /dev/null +++ b/12992/huatuo.in @@ -0,0 +1,101 @@ +100 +68 +80 +100 +26 +95 +10 +9 +43 +94 +97 +30 +16 +18 +6 +8 +74 +59 +23 +15 +93 +76 +55 +45 +91 +96 +64 +63 +46 +21 +40 +4 +81 +82 +49 +27 +78 +47 +35 +2 +87 +37 +61 +48 +3 +66 +42 +13 +85 +58 +60 +44 +38 +84 +92 +56 +65 +19 +54 +22 +73 +77 +86 +24 +31 +1 +88 +39 +67 +32 +72 +11 +75 +89 +99 +71 +41 +34 +20 +7 +70 +17 +25 +83 +79 +51 +90 +12 +14 +5 +98 +57 +28 +69 +50 +33 +53 +62 +36 +29 +52 diff --git a/591/bricks.c b/591/bricks.c new file mode 100644 index 0000000..bd4d047 --- /dev/null +++ b/591/bricks.c @@ -0,0 +1,23 @@ +#include <stdio.h> + +int main(){ + int n, j=0; + scanf("%d", &n); + while(n>0){ + j++; + int heights[100], avg, sum=0, i, moves=0, move, h; + for(i=0; i<n; i++){ + scanf("%d", &h); + sum+=h; + heights[i]=h; + } + avg = sum/n; + for(i=0; i<n; i++){ + move = avg-heights[i]; + moves += (move < 0 ? move*-1 : move); + } + printf("Set #%d\nThe minimum number of moves is %d.\n\n", j, moves/2); + scanf("%d", &n); + } + return 0; +} diff --git a/591/bricks.in b/591/bricks.in new file mode 100644 index 0000000..5d2efdf --- /dev/null +++ b/591/bricks.in @@ -0,0 +1,3 @@ +4 +1 1 3 3 +0
\ No newline at end of file |
