fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. const double pi=3.141592653589793238463;
  5. int main()
  6. {
  7.  
  8. char type[10];
  9.  
  10. int i;
  11. int t=1,r=1,c=1,count=1;
  12. int index=1;
  13. int in=0;
  14. int cal;
  15.  
  16. double trianglex1[100];
  17. double trianglex2[100];
  18. double trianglex3[100];
  19. double triangley1[100];
  20. double triangley2[100];
  21. double triangley3[100];
  22. double recx1[100];
  23. double recy1[100];
  24. double recx2[100];
  25. double recy2[100];
  26. double circlelong[100];
  27. double circlex[100];
  28. double circley[100];
  29.  
  30. double testx[100];
  31. double testy[100];
  32.  
  33. while(1)
  34. {
  35. cin>>type[count];
  36.  
  37. if(type[count]=='t')
  38. {
  39. cin>>trianglex1[count]>>triangley1[count]>>trianglex2[count]>>triangley2[count]>>trianglex3[count]>>triangley3[count];
  40. count++;
  41. }
  42. else if(type[count]=='r')
  43. {
  44. cin>>recx1[count]>>recy1[count]>>recx2[count]>>recy2[count];
  45. count++;
  46. }
  47. else if(type[count]=='c')
  48. {
  49. cin>>circlex[count]>>circley[count]>>circlelong[count];
  50. count++;
  51. }
  52. else
  53. {
  54. count--;
  55. break;
  56. }
  57. }
  58.  
  59. while(1)
  60. {
  61. cin>>testx[index]>>testy[index];
  62. if(testx[index]==9999.9 && testy[index]==9999.9)
  63. break;
  64. else
  65. {
  66. for(i=1;i<=count;i++)
  67. {
  68. if(type[i]=='r')
  69. {
  70. if(testx[index] > recx1[i] && testx[index] < recx2[i] && testy[index] < recy1[i] && testy[index] > recy2[i] )
  71. {
  72. cout<<"Point "<<index<<" is contained in figure "<<i<<endl;
  73. in=1;
  74. }
  75. }
  76. else if(type[i]=='c')
  77. {
  78. if( sqrt( (testx[index]-circlex[i]) * (testx[index]-circlex[i]) + (testy[index]-circley[i]) * (testy[index]-circley[i]) ) < circlelong[i] )
  79. {
  80. cout<<"Point "<<index<<" is contained in figure "<<i<<endl;
  81. in=1;
  82. }
  83. }
  84. else if(type[i]=='t')
  85. {
  86. cal=( acos( ( (trianglex1[i]-testx[index])*(trianglex2[i]-testx[index])+(triangley1[i]-testy[index])*(triangley2[i]-testy[index]) ) / ( sqrt( (trianglex2[i]-testx[index]) * (trianglex2[i]-testx[index]) + (triangley2[i]-testy[index]) * (triangley2[i]-testy[index]) ) * sqrt( (trianglex1[i]-testx[index]) * (trianglex1[i]-testx[index]) + (triangley1[i]-testy[index]) * (triangley1[i]-testy[index]) ) ) ) *180/pi + acos( ( (trianglex2[i]-testx[index])*(trianglex3[i]-testx[index])+(triangley2[i]-testy[index])*(triangley3[i]-testy[index]) ) / ( sqrt( (trianglex2[i]-testx[index]) * (trianglex2[i]-testx[index]) + (triangley2[i]-testy[index]) * (triangley2[i]-testy[index]) ) * sqrt( (trianglex3[i]-testx[index]) * (trianglex3[i]-testx[index]) + (triangley3[i]-testy[index]) * (triangley3[i]-testy[index]) ) ) ) *180/pi + acos( ( (trianglex1[i]-testx[index])*(trianglex3[i]-testx[index])+(triangley1[i]-testy[index])*(triangley3[i]-testy[index]) ) / ( sqrt( (trianglex1[i]-testx[index]) * (trianglex1[i]-testx[index]) + (triangley1[i]-testy[index]) * (triangley1[i]-testy[index]) ) * sqrt( (trianglex3[i]-testx[index]) * (trianglex3[i]-testx[index]) + (triangley3[i]-testy[index]) * (triangley3[i]-testy[index]) ) ) ) *180/pi );
  87. if(cal == 360 )
  88. {
  89. cout<<"Point "<<index<<" is contained in figure "<<i<<endl;
  90. in=1;
  91. }
  92. }
  93. }
  94.  
  95. if(in==0)
  96. cout<<"Point "<<index<<" is not contained in any figure "<<endl;
  97. index++;
  98. in=0;
  99. }
  100. }
  101.  
  102. return 0;
  103. }
Runtime error #stdin #stdout 0s 3348KB
stdin
Standard input is empty
stdout
Point 1 is not contained in any figure 
Point 2 is not contained in any figure 
Point 3 is not contained in any figure 
Point 4 is not contained in any figure 
Point 5 is not contained in any figure 
Point 6 is not contained in any figure 
Point 7 is not contained in any figure 
Point 8 is not contained in any figure 
Point 9 is not contained in any figure 
Point 10 is not contained in any figure 
Point 11 is not contained in any figure 
Point 12 is not contained in any figure 
Point 13 is not contained in any figure 
Point 14 is not contained in any figure 
Point 15 is not contained in any figure 
Point 16 is not contained in any figure 
Point 17 is not contained in any figure 
Point 18 is not contained in any figure 
Point 19 is not contained in any figure 
Point 20 is not contained in any figure 
Point 21 is not contained in any figure 
Point 22 is not contained in any figure 
Point 23 is not contained in any figure 
Point 24 is not contained in any figure 
Point 25 is not contained in any figure 
Point 26 is not contained in any figure 
Point 27 is not contained in any figure 
Point 28 is not contained in any figure 
Point 29 is not contained in any figure 
Point 30 is not contained in any figure 
Point 31 is not contained in any figure 
Point 32 is not contained in any figure 
Point 33 is not contained in any figure 
Point 34 is not contained in any figure 
Point 35 is not contained in any figure 
Point 36 is not contained in any figure 
Point 37 is not contained in any figure 
Point 38 is not contained in any figure 
Point 39 is not contained in any figure 
Point 40 is not contained in any figure 
Point 41 is not contained in any figure 
Point 42 is not contained in any figure 
Point 43 is not contained in any figure 
Point 44 is not contained in any figure 
Point 45 is not contained in any figure 
Point 46 is not contained in any figure 
Point 47 is not contained in any figure 
Point 48 is not contained in any figure 
Point 49 is not contained in any figure 
Point 50 is not contained in any figure 
Point 51 is not contained in any figure 
Point 52 is not contained in any figure 
Point 53 is not contained in any figure 
Point 54 is not contained in any figure 
Point 55 is not contained in any figure 
Point 56 is not contained in any figure 
Point 57 is not contained in any figure 
Point 58 is not contained in any figure 
Point 59 is not contained in any figure 
Point 60 is not contained in any figure 
Point 61 is not contained in any figure 
Point 62 is not contained in any figure 
Point 63 is not contained in any figure 
Point 64 is not contained in any figure 
Point 65 is not contained in any figure 
Point 66 is not contained in any figure 
Point 67 is not contained in any figure 
Point 68 is not contained in any figure 
Point 69 is not contained in any figure 
Point 70 is not contained in any figure 
Point 71 is not contained in any figure 
Point 72 is not contained in any figure 
Point 73 is not contained in any figure 
Point 74 is not contained in any figure 
Point 75 is not contained in any figure 
Point 76 is not contained in any figure 
Point 77 is not contained in any figure 
Point 78 is not contained in any figure 
Point 79 is not contained in any figure 
Point 80 is not contained in any figure 
Point 81 is not contained in any figure 
Point 82 is not contained in any figure 
Point 83 is not contained in any figure 
Point 84 is not contained in any figure 
Point 85 is not contained in any figure 
Point 86 is not contained in any figure 
Point 87 is not contained in any figure 
Point 88 is not contained in any figure 
Point 89 is not contained in any figure 
Point 90 is not contained in any figure 
Point 91 is not contained in any figure 
Point 92 is not contained in any figure 
Point 93 is not contained in any figure 
Point 94 is not contained in any figure 
Point 95 is not contained in any figure 
Point 96 is not contained in any figure 
Point 97 is not contained in any figure 
Point 98 is not contained in any figure 
Point 99 is not contained in any figure 
Point 100 is not contained in any figure 
Point 101 is not contained in any figure 
Point 102 is not contained in any figure 
Point 103 is not contained in any figure 
Point 104 is not contained in any figure 
Point 105 is not contained in any figure 
Point 106 is not contained in any figure 
Point 107 is not contained in any figure 
Point 108 is not contained in any figure 
Point 109 is not contained in any figure 
Point 110 is not contained in any figure 
Point 111 is not contained in any figure 
Point 112 is not contained in any figure 
Point 113 is not contained in any figure 
Point 114 is not contained in any figure 
Point 115 is not contained in any figure 
Point 116 is not contained in any figure 
Point 117 is not contained in any figure 
Point 118 is not contained in any figure 
Point 119 is not contained in any figure 
Point 120 is not contained in any figure 
Point 121 is not contained in any figure 
Point 122 is not contained in any figure 
Point 123 is not contained in any figure 
Point 124 is not contained in any figure 
Point 125 is not contained in any figure 
Point 126 is not contained in any figure 
Point 127 is not contained in any figure 
Point 128 is not contained in any figure 
Point 129 is not contained in any figure 
Point 130 is not contained in any figure 
Point 131 is not contained in any figure 
Point 132 is not contained in any figure 
Point 133 is not contained in any figure 
Point 134 is not contained in any figure 
Point 135 is not contained in any figure 
Point 136 is not contained in any figure 
Point 137 is not contained in any figure 
Point 138 is not contained in any figure 
Point 139 is not contained in any figure 
Point 140 is not contained in any figure 
Point 141 is not contained in any figure 
Point 142 is not contained in any figure 
Point 143 is not contained in any figure 
Point 144 is not contained in any figure 
Point 145 is not contained in any figure 
Point 146 is not contained in any figure 
Point 147 is not contained in any figure 
Point 148 is not contained in any figure 
Point 149 is not contained in any figure 
Point 150 is not contained in any figure 
Point 151 is not contained in any figure 
Point 152 is not contained in any figure 
Point 153 is not contained in any figure 
Point 154 is not contained in any figure 
Point 155 is not contained in any figure 
Point 156 is not contained in any figure 
Point 157 is not contained in any figure 
Point 158 is not contained in any figure 
Point 159 is not contained in any figure 
Point 160 is not contained in any figure 
Point 161 is not contained in any figure 
Point 162 is not contained in any figure 
Point 163 is not contained in any figure 
Point 164 is not contained in any figure 
Point 165 is not contained in any figure 
Point 166 is not contained in any figure 
Point 167 is not contained in any figure 
Point 168 is not contained in any figure 
Point 169 is not contained in any figure 
Point 170 is not contained in any figure 
Point 171 is not contained in any figure 
Point 172 is not contained in any figure 
Point 173 is not contained in any figure 
Point 174 is not contained in any figure 
Point 175 is not contained in any figure 
Point 176 is not contained in any figure 
Point 177 is not contained in any figure 
Point 178 is not contained in any figure 
Point 179 is not contained in any figure 
Point 180 is not contained in any figure 
Point 181 is not contained in any figure 
Point 182 is not contained in any figure 
Point 183 is not contained in any figure 
Point 184 is not contained in any figure 
Point 185 is not contained in any figure 
Point 186 is not contained in any figure 
Point 187 is not contained in any figure 
Point 188 is not contained in any figure 
Point 189 is not contained in any figure 
Point 190 is not contained in any figure 
Point 191 is not contained in any figure 
Point 192 is not contained in any figure 
Point 193 is not contained in any figure 
Point 194 is not contained in any figure 
Point 195 is not contained in any figure 
Point 196 is not contained in any figure 
Point 197 is not contained in any figure 
Point 198 is not contained in any figure 
Point 199 is not contained in any figure 
Point 200 is not contained in any figure 
Point 201 is not contained in any figure 
Point 202 is not contained in any figure 
Point 203 is not contained in any figure 
Point 204 is not contained in any figure 
Point 205 is not contained in any figure 
Point 206 is not contained in any figure 
Point 207 is not contained in any figure 
Point 208 is not contained in any figure 
Point 209 is not contained in any figure 
Point 210 is not contained in any figure 
Point 211 is not contained in any figure 
Point 212 is not contained in any figure 
Point 213 is not contained in any figure 
Point 214 is not contained in any figure 
Point 215 is not contained in any figure 
Point 216 is not contained in any figure 
Point 217 is not contained in any figure 
Point 218 is not contained in any figure 
Point 219 is not contained in any figure 
Point 220 is not contained in any figure 
Point 221 is not contained in any figure 
Point 222 is not contained in any figure 
Point 223 is not contained in any figure 
Point 224 is not contained in any figure 
Point 225 is not contained in any figure 
Point 226 is not contained in any figure 
Point 227 is not contained in any figure 
Point 228 is not contained in any figure 
Point 229 is not contained in any figure 
Point 230 is not contained in any figure 
Point 231 is not contained in any figure 
Point 232 is not contained in any figure 
Point 233 is not contained in any figure 
Point 234 is not contained in any figure 
Point 235 is not contained in any figure 
Point 236 is not contained in any figure 
Point 237 is not contained in any figure 
Point 238 is not contained in any figure 
Point 239 is not contained in any figure 
Point 240 is not contained in any figure 
Point 241 is not contained in any figure 
Point 242 is not contained in any figure 
Point 243 is not contained in any figure 
Point 244 is not contained in any figure 
Point 245 is not contained in any figure 
Point 246 is not contained in any figure 
Point 247 is not contained in any figure 
Point 248 is not contained in any figure 
Point 249 is not contained in any figure 
Point 250 is not contained in any figure 
Point 251 is not contained in any figure 
Point 252 is not contained in any figure 
Point 253 is not contained in any figure 
Point 254 is not contained in any figure 
Point 255 is not contained in any figure 
Point 256 is not contained in any figure 
Point 257 is not contained in any figure 
Point 258 is not contained in any figure 
Point 259 is not contained in any figure 
Point 260 is not contained in any figure 
Point 261 is not contained in any figure 
Point 262 is not contained in any figure 
Point 263 is not contained in any figure 
Point 264 is not contained in any figure 
Point 265 is not contained in any figure 
Point 266 is not contained in any figure 
Point 267 is not contained in any figure 
Point 268 is not contained in any figure 
Point 269 is not contained in any figure 
Point 270 is not contained in any figure 
Point 271 is not contained in any figure 
Point 272 is not contained in any figure 
Point 273 is not contained in any figure 
Point 274 is not contained in any figure 
Point 275 is not contained in any figure 
Point 276 is not contained in any figure 
Point 277 is not contained in any figure 
Point 278 is not contained in any figure 
Point 279 is not contained in any figure 
Point 280 is not contained in any figure 
Point 281 is not contained in any figure 
Point 282 is not contained in any figure 
Point 283 is not contained in any figure 
Point 284 is not contained in any figure 
Point 285 is not contained in any figure 
Point 286 is not contained in any figure 
Point 287 is not contained in any figure 
Point 288 is not contained in any figure 
Point 289 is not contained in any figure 
Point 290 is not contained in any figure 
Point 291 is not contained in any figure 
Point 292 is not contained in any figure 
Point 293 is not contained in any figure 
Point 294 is not contained in any figure 
Point 295 is not contained in any figure 
Point 296 is not contained in any figure 
Point 297 is not contained in any figure 
Point 298 is not contained in any figure 
Point 299 is not contained in any figure 
Point 300 is not contained in any figure 
Point 301 is not contained in any figure 
Point 302 is not contained in any figure 
Point 303 is not contained in any figure 
Point 304 is not contained in any figure 
Point 305 is not contained in any figure 
Point 306 is not contained in any figure 
Point 307 is not contained in any figure 
Point 308 is not contained in any figure 
Point 309 is not contained in any figure 
Point 310 is not contained in any figure 
Point 311 is not contained in any figure 
Point 312 is not contained in any figure 
Point 313 is not contained in any figure 
Point 314 is not contained in any figure 
Point 315 is not contained in any figure 
Point 316 is not contained in any figure 
Point 317 is not contained in any figure 
Point 318 is not contained in any figure 
Point 319 is not contained in any figure 
Point 320 is not contained in any figure 
Point 321 is not contained in any figure 
Point 322 is not contained in any figure 
Point 323 is not contained in any figure 
Point 324 is not contained in any figure 
Point 325 is not contained in any figure 
Point 326 is not contained in any figure 
Point 327 is not contained in any figure 
Point 328 is not contained in any figure 
Point 329 is not contained in any figure 
Point 330 is not contained in any figure 
Point 331 is not contained in any figure 
Point 332 is not contained in any figure 
Point 333 is not contained in any figure 
Point 334 is not contained in any figure 
Point 335 is not contained in any figure