You are viewing a single comment's thread. Return to all comments →
#include<stdio.h> int main(void) { int s_apple,t_orange,loc_apple,loc_orange,A_size,o_size,apple[100000],orange[100000],i; int h_apple[100000],h_orange[100000],apple_count=0,orange_count=0; scanf("%d%d",&s_apple,&t_orange); scanf("%d%d",&loc_apple,&loc_orange); scanf("%d%d",&A_size,&o_size); for(i=0;i<A_size;i++) { scanf("%d",&apple[i]); } for(i=0;i<o_size;i++) { scanf("%d",&orange[i]); } for(i=0;i<A_size;i++) { h_apple[i]=loc_apple+(apple[i]); if(h_apple[i]>=s_apple && h_apple[i]<=t_orange) { apple_count=apple_count+1; } } for(i=0;i<o_size;i++) { h_orange[i]=loc_orange+(orange[i]); if(h_orange[i]>=s_apple && h_orange[i]<=t_orange) { orange_count=orange_count+1; } } printf("%d\n",apple_count); printf("%d\n",orange_count); return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Apple and Orange
You are viewing a single comment's thread. Return to all comments →