Advertisement
mhdew

URI 2650 2

Dec 26th, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. int main()
  5. {
  6. int i, n, w, a;
  7. char s[10][1001];
  8. int len[100];
  9. char name[10][1001];
  10. char height[10][1001];
  11. int h[100];
  12.  
  13. scanf("%d%d", &n, &w);
  14. getchar();
  15.  
  16. for(i=0;i<n;i++){
  17. gets(s[i]);
  18.  
  19. len[i]=strlen(s[i]);
  20.  
  21. int j=0;
  22. int k=0;
  23.  
  24. for(a=0;a<len[i];a++){
  25. if(s[i][a]>='0' && s[i][a]<='9'){
  26. height[i][j]=s[i][a];
  27. j++;
  28. }
  29. else{
  30. name[i][k]=s[i][a];
  31. k++;
  32. }
  33. }
  34. k-=2;
  35.  
  36. h[i]=atoi(height[i]);
  37.  
  38. if(h[i]>w){
  39. for(a=0;a<=k;a++){
  40. printf("%c", name[i][a]);
  41. }
  42. printf("\n");
  43. }
  44. }
  45.  
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement