しまった、修正/*BINFMTC: */#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#define max(a,b) ((a) >= (b) ? (a) : (b))int main(int ac, char** av){ int i, sum=0, maxval=0; const char* graphstr="************************************************************************"; int graphstrlen=strlen(graphstr); for (i=1; i<ac; (sum+=atoi(av[i])), (maxval=max(maxval,atoi(av[i]))), ++i) if (atoi(av[i])<0) exit(1); for (i=1; i<ac; ++i) printf("%.2i/%.2i %s\n", atoi(av[i]), sum, graphstr+graphstrlen-atoi(av[i])*graphstrlen/maxval); return 0;}
Re:キミならどう書く 2.0 - ROUND 3 -
しまった、修正
/*BINFMTC:
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define max(a,b) ((a) >= (b) ? (a) : (b))
int main(int ac, char** av)
{
int i, sum=0, maxval=0;
const char* graphstr="************************************************************************";
int graphstrlen=strlen(graphstr);
for (i=1; i<ac; (sum+=atoi(av[i])), (maxval=max(maxval,atoi(av[i]))), ++i) if (atoi(av[i])<0) exit(1);
for (i=1; i<ac; ++i)
printf("%.2i/%.2i %s\n", atoi(av[i]), sum, graphstr+graphstrlen-atoi(av[i])*graphstrlen/maxval);
return 0;
}