fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a[10][10];
  5. int i, y;
  6. for(y = 0;y < 10;y++){
  7. for(i = 0;i < 10;i++){
  8. scanf("%d",&a[y][i]);
  9. }
  10. }
  11. int j;
  12. int b[10];
  13. for(j=0;j<10;j++){
  14. scanf("%d",&b[j]);
  15. }
  16. int cnt = 0;
  17. for(j=0;j < 10;j++){
  18. if(b[j] == 1){
  19. for(i = 9; i >= 0;i--){
  20. if(a[i][j] > 0){
  21. printf("%d crash\n", j+1);
  22. break;
  23. }
  24. if(a[i][j] < 0){
  25. printf("%d fall\n", j+1);
  26. break;
  27. }
  28. if(a[i][j] == 0){
  29. cnt++;
  30. if(cnt == 10){
  31. printf("%d safe\n", j+1);
  32. break;
  33. }
  34. }
  35. }
  36. cnt = 0;
  37. }
  38. }
  39. return 0;
  40. }
Success #stdin #stdout 0s 4672KB
stdin
0 0 0 0 0 0 0 0 0 0 
0 2 0 0 0 0 0 0 0 0 
0 0 -1 0 0 0 0 0 2 0 
0 0 0 0 0 0 0 6 0 0 
0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 -4 2 0 0 0 
0 0 2 0 0 0 0 0 0 0 
0 0 0 0 3 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 
1 1 0 0 1 1 0 1 0 1 
stdout
1 safe
2 crash
5 crash
6 fall
8 crash
10 safe