online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> int main() { int Map[500][500]; int ball[500][500]; int N,r,c,i,j,x,y,t,b,new_x,new_y,count,max_ball; scanf("%d",&N); scanf("%d",&r); scanf("%d",&c); i = 0; j = 0; while(i<N){ j = 0; while(j<N){ Map[i][j] = 0; ball[i][j] = 0; j++; } i++; } Map[r][c] = 1; i = N*N-1; x = r; y = c; t = 1; while(i>0){ x += t; y+=x/N; x%=N; y%=N; while(Map[y][x]!=0){ x += 1; y+=x/N; x%=N; y%=N; } Map[y][x] = t+1; t++; i--; } i = 0; while(i<N){ j = 0; while(j<N){ x = i; y = j; while(1){ new_x = x; new_y = y; b = Map[y][x]; if(Map[y+1][x]<b && y+1<N){ b = Map[y+1][x]; new_x = x; new_y = y+1; } if(Map[y][x+1]<b && x+1<N){ b = Map[y][x+1]; new_x = x+1; new_y = y; } if(Map[y-1][x]<b && y-1>-1){ b = Map[y-1][x]; new_x = x; new_y = y-1; } if(Map[y][x-1]<b && x-1>-1){ b = Map[y][x-1]; new_x = x-1; new_y = y; } if(y == new_y && x == new_x){ break; } x = new_x; y = new_y; } ball[y][x]+=1; j++; } i++; } i = 0; j = 0; count = 0; max_ball = 0; while(i<N){ j = 0; while(j<N){ if(ball[i][j]>max_ball){ max_ball = ball[i][j]; } if(ball[i][j]){ count++; } j++; } i++; } printf("%d %d",count,max_ball); return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue