From 94d0033ed89bb5bfb6500051296892fb7cea6c29 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 25 Dec 2023 17:56:34 +0100 Subject: Small cleanup --- 2023/02/2b.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to '2023/02/2b.c') diff --git a/2023/02/2b.c b/2023/02/2b.c index 1b30114..9d7f357 100644 --- a/2023/02/2b.c +++ b/2023/02/2b.c @@ -1,11 +1,8 @@ -#include #include #include -#include #define N 10000 - -#define MAX(x, y) ((x)>(y) ? (x) : (y)) +#define MAX(x,y) ((x)>(y)?(x):(y)) int color[26] = { ['r'-'a'] = 0, ['g'-'a'] = 1, ['b'-'a'] = 2 }; @@ -18,11 +15,9 @@ int main() { maxc[0] = maxc[1] = maxc[2] = 0; while (*buf++ != ':'); while (*buf++) { - if (*buf < '0' || *buf > '9') - continue; + if (*buf < '0' || *buf > '9') continue; x = atoi(buf); - while (*buf < 'a' || *buf > 'z') - buf++; + while (*buf < 'a' || *buf > 'z') buf++; maxc[color[*buf-'a']] = MAX(maxc[color[*buf-'a']], x); } sum += maxc[0] * maxc[1] * maxc[2]; -- cgit v1.3