fork download
  1. #include <stdio.h>
  2. int main(){
  3. int A[10000][10000];
  4. int i=0,j=0,R=0,C=0,s=0,h=0,x=0,y=0;
  5. scanf("%d %d",&R,&C);
  6. for(i=0;i<R;i++){
  7. for(j=0;j<C;j++){
  8. s++;
  9. A[i][j]=s;
  10. }
  11. printf("\n");
  12. }
  13.  
  14. i=0;
  15. scanf("%d",&h);
  16. while (i<h){
  17. scanf("%d %d",&x,&y);
  18. printf("%d",A[x-1][y-1]);
  19. printf(" ");
  20. i++;
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0s 399936KB
stdin
3 1000
2
2 1
2 10
stdout


1001 1010