fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. using namespace std;
  5. int value[999][18278];
  6. vector <int> con[999][18278];
  7. string str;
  8. void value_clear(int,int);
  9. void parse(char,vector<string>&);
  10. int main(void)
  11. {
  12. int T,r,c;
  13. vector <string> res;
  14. getline(cin,str); T=stoi(str);
  15. while(T--)
  16. {
  17. getline(cin,str); parse(' ',res);
  18. c=stoi(res[0]); r=stoi(res[1]);
  19. value_clear(r,c);
  20. for(int i=0;i<r;i++)
  21. {
  22. getline(cin,str);
  23. parse(' ',res);
  24. for(int j=0;j<res.size();j++)
  25. {
  26. if(res[j][0]!='=')
  27. cout<<res[j]<<" ";
  28. else
  29. {
  30.  
  31. }
  32. }
  33. cout<<"\n";
  34. }
  35. for(int i=0;i<r;i++)
  36. {
  37. for(int j=0;j<c;j++)
  38. con[i][j].clear();
  39. }
  40. }
  41. }
  42.  
  43. void value_clear(int r,int c)
  44. {
  45. for(int i=0;i<r;i++)
  46. {
  47. for(int j=0;j<c;j++)
  48. value[i][j]=0;
  49. }
  50. }
  51. void parse(char ch,vector <string>&res)
  52. {
  53. vector <int> pos; pos.clear(); res.clear();
  54. pos.push_back(-1);
  55. for(int i=0;i<str.length();i++)
  56. {
  57. if(str[i]==ch)
  58. pos.push_back(i);
  59. }
  60. pos.push_back(str.length());
  61. for(int i=0;i<pos.size();i++)
  62. {
  63. if(pos[i]-pos[i-1]>1)
  64. {
  65. //pos[i-1]+1부터 pos[i]-pos[i-1]-1개
  66. res.push_back(str.substr(pos[i-1]+1,pos[i]-pos[i-1]-1));
  67. }
  68. }
  69. }
Success #stdin #stdout 0.17s 431100KB
stdin
1
4 3
10 34 37 =A1+B1+C1
40 17 34 =A2+B2+C2
=A1+A2 =B1+B2 =C1+C2 =D1+D2
stdout
10 34 37 
40 17 34