arrow_upward
Is there any wise man who is good at C?
#1
Can you take a look at what I made?
I don't know what the problem is.
I need your help!


#include <stdio.h>

int main()
{
int a, b, v;
int arr[101] = { 0, };
int ans = 0;
scanf("%d %d %d", &a, &b, &c);

for (int i = 0; i < 3; i++)
{
int arrive, leave;
scanf("%d %d", &arrive, &leave);
for (int j = arrive; j < leave; j++)
arr[j]++;
}

for (int i = 1; i <= 100; i++)
{
switch (arr[i])
{
case 1:
ans += a;
break;
case 2:
ans += (b*2);
break;
case 3:
ans += (c*3);
break;
}
}
printf("%d\n", ans);
return 0;
}



#2
I found my problem....
What a stupid...
I didnt do Int C!!!!



[+] 1 user Likes llinkge551's post
#3
Nice call. Small but tricky bug!



#4
True dat. Looks satisfying  Smile