2019杭电多校第八场

比赛记录

lfw写1011贪心,WA,改成nlogn T,加上freadinlineregister ,T,想出正解后,WA,shl写了才过

lfw写1009几何分类,WA,shl改成离散化dfs才过

lfw和byf oeis出1003,打表过了,lfw终于过了今天第一题

都是byf究极毒奶,中午吃饭的时候跟llg说lfw做水题又快又猛,然后下午lfw键盘冒奶

晚上byf奶rng必不可能输,然后rng 0:2

题解

1001Acesrc and Cube Hypernet

1002Acesrc and Girlfriend

1003Acesrc and Good Numbers

oeis后打表

  1 #include<bits/stdc++.h>
  2 
  3 using namespace std;
  4 
  5 int d;long long x;
  6 long long a[10][545];
  7 int cnt[10];
  8 
  9 inline void init()
 10 {
 11     cnt[1]=84;cnt[2]=14;cnt[3]=36;cnt[4]=48;cnt[5]=5;
 12     cnt[6]=72;cnt[7]=49;cnt[8]=344;cnt[9]=9;
 13     a[1][1]=0;
 14 a[1][2]=1;
 15 a[1][3]=199981;
 16 a[1][4]=199982;
 17 a[1][5]=199983;
 18 a[1][6]=199984;
 19 a[1][7]=199985;
 20 a[1][8]=199986;
 21 a[1][9]=199987;
 22 a[1][10]=199988;
 23 a[1][11]=199989;
 24 a[1][12]=199990;
 25 a[1][13]=200000;
 26 a[1][14]=200001;
 27 a[1][15]=1599981;
 28 a[1][16]=1599982;
 29 a[1][17]=1599983;
 30 a[1][18]=1599984;
 31 a[1][19]=1599985;
 32 a[1][20]=1599986;
 33 a[1][21]=1599987;
 34 a[1][22]=1599988;
 35 a[1][23]=1599989;
 36 a[1][24]=1599990;
 37 a[1][25]=2600000;
 38 a[1][26]=2600001;
 39 a[1][27]=13199998;
 40 a[1][28]=35000000;
 41 a[1][29]=35000001;
 42 a[1][30]=35199981;
 43 a[1][31]=35199982;
 44 a[1][32]=35199983;
 45 a[1][33]=35199984;
 46 a[1][34]=35199985;
 47 a[1][35]=35199986;
 48 a[1][36]=35199987;
 49 a[1][37]=35199988;
 50 a[1][38]=35199989;
 51 a[1][39]=35199990;
 52 a[1][40]=35200000;
 53 a[1][41]=35200001;
 54 a[1][42]=117463825;
 55 a[1][43]=500000000;
 56 a[1][44]=500000001;
 57 a[1][45]=500199981;
 58 a[1][46]=500199982;
 59 a[1][47]=500199983;
 60 a[1][48]=500199984;
 61 a[1][49]=500199985;
 62 a[1][50]=500199986;
 63 a[1][51]=500199987;
 64 a[1][52]=500199988;
 65 a[1][53]=500199989;
 66 a[1][54]=500199990;
 67 a[1][55]=500200000;
 68 a[1][56]=500200001;
 69 a[1][57]=501599981;
 70 a[1][58]=501599982;
 71 a[1][59]=501599983;
 72 a[1][60]=501599984;
 73 a[1][61]=501599985;
 74 a[1][62]=501599986;
 75 a[1][63]=501599987;
 76 a[1][64]=501599988;
 77 a[1][65]=501599989;
 78 a[1][66]=501599990;
 79 a[1][67]=502600000;
 80 a[1][68]=502600001;
 81 a[1][69]=513199998;
 82 a[1][70]=535000000;
 83 a[1][71]=535000001;
 84 a[1][72]=535199981;
 85 a[1][73]=535199982;
 86 a[1][74]=535199983;
 87 a[1][75]=535199984;
 88 a[1][76]=535199985;
 89 a[1][77]=535199986;
 90 a[1][78]=535199987;
 91 a[1][79]=535199988;
 92 a[1][80]=535199989;
 93 a[1][81]=535199990;
 94 a[1][82]=535200000;
 95 a[1][83]=535200001;
 96 a[1][84]=1111111110;
 97 a[2][1]=0;
 98 a[2][2]=28263827;
 99 a[2][3]=35000000;
100 a[2][4]=242463827;
101 a[2][5]=500000000;
102 a[2][6]=528263827;
103 a[2][7]=535000000;
104 a[2][8]=10000000000;
105 a[2][9]=10028263827;
106 a[2][10]=10035000000;
107 a[2][11]=10242463827;
108 a[2][12]=10500000000;
109 a[2][13]=10528263827;
110 a[2][14]=10535000000;
111 a[3][1]=0;
112 a[3][2]=371599983;
113 a[3][3]=371599984;
114 a[3][4]=371599985;
115 a[3][5]=371599986;
116 a[3][6]=371599987;
117 a[3][7]=371599988;
118 a[3][8]=371599989;
119 a[3][9]=371599990;
120 a[3][10]=371599991;
121 a[3][11]=371599992;
122 a[3][12]=500000000;
123 a[3][13]=10000000000;
124 a[3][14]=10371599983;
125 a[3][15]=10371599984;
126 a[3][16]=10371599985;
127 a[3][17]=10371599986;
128 a[3][18]=10371599987;
129 a[3][19]=10371599988;
130 a[3][20]=10371599989;
131 a[3][21]=10371599990;
132 a[3][22]=10371599991;
133 a[3][23]=10371599992;
134 a[3][24]=10500000000;
135 a[3][25]=20000000000;
136 a[3][26]=20371599983;
137 a[3][27]=20371599984;
138 a[3][28]=20371599985;
139 a[3][29]=20371599986;
140 a[3][30]=20371599987;
141 a[3][31]=20371599988;
142 a[3][32]=20371599989;
143 a[3][33]=20371599990;
144 a[3][34]=20371599991;
145 a[3][35]=20371599992;
146 a[3][36]=20500000000;
147 a[4][1]=0;
148 a[4][2]=499999984;
149 a[4][3]=499999985;
150 a[4][4]=499999986;
151 a[4][5]=499999987;
152 a[4][6]=499999988;
153 a[4][7]=499999989;
154 a[4][8]=499999990;
155 a[4][9]=499999991;
156 a[4][10]=499999992;
157 a[4][11]=499999993;
158 a[4][12]=500000000;
159 a[4][13]=10000000000;
160 a[4][14]=10499999984;
161 a[4][15]=10499999985;
162 a[4][16]=10499999986;
163 a[4][17]=10499999987;
164 a[4][18]=10499999988;
165 a[4][19]=10499999989;
166 a[4][20]=10499999990;
167 a[4][21]=10499999991;
168 a[4][22]=10499999992;
169 a[4][23]=10499999993;
170 a[4][24]=10500000000;
171 a[4][25]=20000000000;
172 a[4][26]=20499999984;
173 a[4][27]=20499999985;
174 a[4][28]=20499999986;
175 a[4][29]=20499999987;
176 a[4][30]=20499999988;
177 a[4][31]=20499999989;
178 a[4][32]=20499999990;
179 a[4][33]=20499999991;
180 a[4][34]=20499999992;
181 a[4][35]=20499999993;
182 a[4][36]=20500000000;
183 a[4][37]=30000000000;
184 a[4][38]=30499999984;
185 a[4][39]=30499999985;
186 a[4][40]=30499999986;
187 a[4][41]=30499999987;
188 a[4][42]=30499999988;
189 a[4][43]=30499999989;
190 a[4][44]=30499999990;
191 a[4][45]=30499999991;
192 a[4][46]=30499999992;
193 a[4][47]=30499999993;
194 a[4][48]=30500000000;
195 a[5][1]=0;
196 a[5][2]=10000000000;
197 a[5][3]=20000000000;
198 a[5][4]=30000000000;
199 a[5][5]=40000000000;
200 a[6][1]=0;
201 a[6][2]=9500000000;
202 a[6][3]=9628399986;
203 a[6][4]=9628399987;
204 a[6][5]=9628399988;
205 a[6][6]=9628399989;
206 a[6][7]=9628399990;
207 a[6][8]=9628399991;
208 a[6][9]=9628399992;
209 a[6][10]=9628399993;
210 a[6][11]=9628399994;
211 a[6][12]=9628399995;
212 a[6][13]=10000000000;
213 a[6][14]=19500000000;
214 a[6][15]=19628399986;
215 a[6][16]=19628399987;
216 a[6][17]=19628399988;
217 a[6][18]=19628399989;
218 a[6][19]=19628399990;
219 a[6][20]=19628399991;
220 a[6][21]=19628399992;
221 a[6][22]=19628399993;
222 a[6][23]=19628399994;
223 a[6][24]=19628399995;
224 a[6][25]=20000000000;
225 a[6][26]=29500000000;
226 a[6][27]=29628399986;
227 a[6][28]=29628399987;
228 a[6][29]=29628399988;
229 a[6][30]=29628399989;
230 a[6][31]=29628399990;
231 a[6][32]=29628399991;
232 a[6][33]=29628399992;
233 a[6][34]=29628399993;
234 a[6][35]=29628399994;
235 a[6][36]=29628399995;
236 a[6][37]=30000000000;
237 a[6][38]=39500000000;
238 a[6][39]=39628399986;
239 a[6][40]=39628399987;
240 a[6][41]=39628399988;
241 a[6][42]=39628399989;
242 a[6][43]=39628399990;
243 a[6][44]=39628399991;
244 a[6][45]=39628399992;
245 a[6][46]=39628399993;
246 a[6][47]=39628399994;
247 a[6][48]=39628399995;
248 a[6][49]=40000000000;
249 a[6][50]=49500000000;
250 a[6][51]=49628399986;
251 a[6][52]=49628399987;
252 a[6][53]=49628399988;
253 a[6][54]=49628399989;
254 a[6][55]=49628399990;
255 a[6][56]=49628399991;
256 a[6][57]=49628399992;
257 a[6][58]=49628399993;
258 a[6][59]=49628399994;
259 a[6][60]=49628399995;
260 a[6][61]=50000000000;
261 a[6][62]=59500000000;
262 a[6][63]=59628399986;
263 a[6][64]=59628399987;
264 a[6][65]=59628399988;
265 a[6][66]=59628399989;
266 a[6][67]=59628399990;
267 a[6][68]=59628399991;
268 a[6][69]=59628399992;
269 a[6][70]=59628399993;
270 a[6][71]=59628399994;
271 a[6][72]=59628399995;
272 a[7][1]=0;
273 a[7][2]=9465000000;
274 a[7][3]=9471736170;
275 a[7][4]=9500000000;
276 a[7][5]=9757536170;
277 a[7][6]=9965000000;
278 a[7][7]=9971736170;
279 a[7][8]=10000000000;
280 a[7][9]=19465000000;
281 a[7][10]=19471736170;
282 a[7][11]=19500000000;
283 a[7][12]=19757536170;
284 a[7][13]=19965000000;
285 a[7][14]=19971736170;
286 a[7][15]=20000000000;
287 a[7][16]=29465000000;
288 a[7][17]=29471736170;
289 a[7][18]=29500000000;
290 a[7][19]=29757536170;
291 a[7][20]=29965000000;
292 a[7][21]=29971736170;
293 a[7][22]=30000000000;
294 a[7][23]=39465000000;
295 a[7][24]=39471736170;
296 a[7][25]=39500000000;
297 a[7][26]=39757536170;
298 a[7][27]=39965000000;
299 a[7][28]=39971736170;
300 a[7][29]=40000000000;
301 a[7][30]=49465000000;
302 a[7][31]=49471736170;
303 a[7][32]=49500000000;
304 a[7][33]=49757536170;
305 a[7][34]=49965000000;
306 a[7][35]=49971736170;
307 a[7][36]=50000000000;
308 a[7][37]=59465000000;
309 a[7][38]=59471736170;
310 a[7][39]=59500000000;
311 a[7][40]=59757536170;
312 a[7][41]=59965000000;
313 a[7][42]=59971736170;
314 a[7][43]=60000000000;
315 a[7][44]=69465000000;
316 a[7][45]=69471736170;
317 a[7][46]=69500000000;
318 a[7][47]=69757536170;
319 a[7][48]=69965000000;
320 a[7][49]=69971736170;
321 a[8][1]=0;
322 a[8][2]=9465000000;
323 a[8][3]=9486799989;
324 a[8][4]=9486799990;
325 a[8][5]=9486799991;
326 a[8][6]=9486799992;
327 a[8][7]=9486799993;
328 a[8][8]=9486799994;
329 a[8][9]=9486799995;
330 a[8][10]=9486799996;
331 a[8][11]=9486799997;
332 a[8][12]=9497400000;
333 a[8][13]=9498399989;
334 a[8][14]=9498399990;
335 a[8][15]=9498399991;
336 a[8][16]=9498399992;
337 a[8][17]=9498399993;
338 a[8][18]=9498399994;
339 a[8][19]=9498399995;
340 a[8][20]=9498399996;
341 a[8][21]=9498399997;
342 a[8][22]=9500000000;
343 a[8][23]=9882536171;
344 a[8][24]=9965000000;
345 a[8][25]=9986799989;
346 a[8][26]=9986799990;
347 a[8][27]=9986799991;
348 a[8][28]=9986799992;
349 a[8][29]=9986799993;
350 a[8][30]=9986799994;
351 a[8][31]=9986799995;
352 a[8][32]=9986799996;
353 a[8][33]=9986799997;
354 a[8][34]=9997400000;
355 a[8][35]=9998399989;
356 a[8][36]=9998399990;
357 a[8][37]=9998399991;
358 a[8][38]=9998399992;
359 a[8][39]=9998399993;
360 a[8][40]=9998399994;
361 a[8][41]=9998399995;
362 a[8][42]=9998399996;
363 a[8][43]=9998399997;
364 a[8][44]=10000000000;
365 a[8][45]=19465000000;
366 a[8][46]=19486799989;
367 a[8][47]=19486799990;
368 a[8][48]=19486799991;
369 a[8][49]=19486799992;
370 a[8][50]=19486799993;
371 a[8][51]=19486799994;
372 a[8][52]=19486799995;
373 a[8][53]=19486799996;
374 a[8][54]=19486799997;
375 a[8][55]=19497400000;
376 a[8][56]=19498399989;
377 a[8][57]=19498399990;
378 a[8][58]=19498399991;
379 a[8][59]=19498399992;
380 a[8][60]=19498399993;
381 a[8][61]=19498399994;
382 a[8][62]=19498399995;
383 a[8][63]=19498399996;
384 a[8][64]=19498399997;
385 a[8][65]=19500000000;
386 a[8][66]=19882536171;
387 a[8][67]=19965000000;
388 a[8][68]=19986799989;
389 a[8][69]=19986799990;
390 a[8][70]=19986799991;
391 a[8][71]=19986799992;
392 a[8][72]=19986799993;
393 a[8][73]=19986799994;
394 a[8][74]=19986799995;
395 a[8][75]=19986799996;
396 a[8][76]=19986799997;
397 a[8][77]=19997400000;
398 a[8][78]=19998399989;
399 a[8][79]=19998399990;
400 a[8][80]=19998399991;
401 a[8][81]=19998399992;
402 a[8][82]=19998399993;
403 a[8][83]=19998399994;
404 a[8][84]=19998399995;
405 a[8][85]=19998399996;
406 a[8][86]=19998399997;
407 a[8][87]=20000000000;
408 a[8][88]=29465000000;
409 a[8][89]=29486799989;
410 a[8][90]=29486799990;
411 a[8][91]=29486799991;
412 a[8][92]=29486799992;
413 a[8][93]=29486799993;
414 a[8][94]=29486799994;
415 a[8][95]=29486799995;
416 a[8][96]=29486799996;
417 a[8][97]=29486799997;
418 a[8][98]=29497400000;
419 a[8][99]=29498399989;
420 a[8][100]=29498399990;
421 a[8][101]=29498399991;
422 a[8][102]=29498399992;
423 a[8][103]=29498399993;
424 a[8][104]=29498399994;
425 a[8][105]=29498399995;
426 a[8][106]=29498399996;
427 a[8][107]=29498399997;
428 a[8][108]=29500000000;
429 a[8][109]=29882536171;
430 a[8][110]=29965000000;
431 a[8][111]=29986799989;
432 a[8][112]=29986799990;
433 a[8][113]=29986799991;
434 a[8][114]=29986799992;
435 a[8][115]=29986799993;
436 a[8][116]=29986799994;
437 a[8][117]=29986799995;
438 a[8][118]=29986799996;
439 a[8][119]=29986799997;
440 a[8][120]=29997400000;
441 a[8][121]=29998399989;
442 a[8][122]=29998399990;
443 a[8][123]=29998399991;
444 a[8][124]=29998399992;
445 a[8][125]=29998399993;
446 a[8][126]=29998399994;
447 a[8][127]=29998399995;
448 a[8][128]=29998399996;
449 a[8][129]=29998399997;
450 a[8][130]=30000000000;
451 a[8][131]=39465000000;
452 a[8][132]=39486799989;
453 a[8][133]=39486799990;
454 a[8][134]=39486799991;
455 a[8][135]=39486799992;
456 a[8][136]=39486799993;
457 a[8][137]=39486799994;
458 a[8][138]=39486799995;
459 a[8][139]=39486799996;
460 a[8][140]=39486799997;
461 a[8][141]=39497400000;
462 a[8][142]=39498399989;
463 a[8][143]=39498399990;
464 a[8][144]=39498399991;
465 a[8][145]=39498399992;
466 a[8][146]=39498399993;
467 a[8][147]=39498399994;
468 a[8][148]=39498399995;
469 a[8][149]=39498399996;
470 a[8][150]=39498399997;
471 a[8][151]=39500000000;
472 a[8][152]=39882536171;
473 a[8][153]=39965000000;
474 a[8][154]=39986799989;
475 a[8][155]=39986799990;
476 a[8][156]=39986799991;
477 a[8][157]=39986799992;
478 a[8][158]=39986799993;
479 a[8][159]=39986799994;
480 a[8][160]=39986799995;
481 a[8][161]=39986799996;
482 a[8][162]=39986799997;
483 a[8][163]=39997400000;
484 a[8][164]=39998399989;
485 a[8][165]=39998399990;
486 a[8][166]=39998399991;
487 a[8][167]=39998399992;
488 a[8][168]=39998399993;
489 a[8][169]=39998399994;
490 a[8][170]=39998399995;
491 a[8][171]=39998399996;
492 a[8][172]=39998399997;
493 a[8][173]=40000000000;
494 a[8][174]=49465000000;
495 a[8][175]=49486799989;
496 a[8][176]=49486799990;
497 a[8][177]=49486799991;
498 a[8][178]=49486799992;
499 a[8][179]=49486799993;
500 a[8][180]=49486799994;
501 a[8][181]=49486799995;
502 a[8][182]=49486799996;
503 a[8][183]=49486799997;
504 a[8][184]=49497400000;
505 a[8][185]=49498399989;
506 a[8][186]=49498399990;
507 a[8][187]=49498399991;
508 a[8][188]=49498399992;
509 a[8][189]=49498399993;
510 a[8][190]=49498399994;
511 a[8][191]=49498399995;
512 a[8][192]=49498399996;
513 a[8][193]=49498399997;
514 a[8][194]=49500000000;
515 a[8][195]=49882536171;
516 a[8][196]=49965000000;
517 a[8][197]=49986799989;
518 a[8][198]=49986799990;
519 a[8][199]=49986799991;
520 a[8][200]=49986799992;
521 a[8][201]=49986799993;
522 a[8][202]=49986799994;
523 a[8][203]=49986799995;
524 a[8][204]=49986799996;
525 a[8][205]=49986799997;
526 a[8][206]=49997400000;
527 a[8][207]=49998399989;
528 a[8][208]=49998399990;
529 a[8][209]=49998399991;
530 a[8][210]=49998399992;
531 a[8][211]=49998399993;
532 a[8][212]=49998399994;
533 a[8][213]=49998399995;
534 a[8][214]=49998399996;
535 a[8][215]=49998399997;
536 a[8][216]=50000000000;
537 a[8][217]=59465000000;
538 a[8][218]=59486799989;
539 a[8][219]=59486799990;
540 a[8][220]=59486799991;
541 a[8][221]=59486799992;
542 a[8][222]=59486799993;
543 a[8][223]=59486799994;
544 a[8][224]=59486799995;
545 a[8][225]=59486799996;
546 a[8][226]=59486799997;
547 a[8][227]=59497400000;
548 a[8][228]=59498399989;
549 a[8][229]=59498399990;
550 a[8][230]=59498399991;
551 a[8][231]=59498399992;
552 a[8][232]=59498399993;
553 a[8][233]=59498399994;
554 a[8][234]=59498399995;
555 a[8][235]=59498399996;
556 a[8][236]=59498399997;
557 a[8][237]=59500000000;
558 a[8][238]=59882536171;
559 a[8][239]=59965000000;
560 a[8][240]=59986799989;
561 a[8][241]=59986799990;
562 a[8][242]=59986799991;
563 a[8][243]=59986799992;
564 a[8][244]=59986799993;
565 a[8][245]=59986799994;
566 a[8][246]=59986799995;
567 a[8][247]=59986799996;
568 a[8][248]=59986799997;
569 a[8][249]=59997400000;
570 a[8][250]=59998399989;
571 a[8][251]=59998399990;
572 a[8][252]=59998399991;
573 a[8][253]=59998399992;
574 a[8][254]=59998399993;
575 a[8][255]=59998399994;
576 a[8][256]=59998399995;
577 a[8][257]=59998399996;
578 a[8][258]=59998399997;
579 a[8][259]=60000000000;
580 a[8][260]=69465000000;
581 a[8][261]=69486799989;
582 a[8][262]=69486799990;
583 a[8][263]=69486799991;
584 a[8][264]=69486799992;
585 a[8][265]=69486799993;
586 a[8][266]=69486799994;
587 a[8][267]=69486799995;
588 a[8][268]=69486799996;
589 a[8][269]=69486799997;
590 a[8][270]=69497400000;
591 a[8][271]=69498399989;
592 a[8][272]=69498399990;
593 a[8][273]=69498399991;
594 a[8][274]=69498399992;
595 a[8][275]=69498399993;
596 a[8][276]=69498399994;
597 a[8][277]=69498399995;
598 a[8][278]=69498399996;
599 a[8][279]=69498399997;
600 a[8][280]=69500000000;
601 a[8][281]=69882536171;
602 a[8][282]=69965000000;
603 a[8][283]=69986799989;
604 a[8][284]=69986799990;
605 a[8][285]=69986799991;
606 a[8][286]=69986799992;
607 a[8][287]=69986799993;
608 a[8][288]=69986799994;
609 a[8][289]=69986799995;
610 a[8][290]=69986799996;
611 a[8][291]=69986799997;
612 a[8][292]=69997400000;
613 a[8][293]=69998399989;
614 a[8][294]=69998399990;
615 a[8][295]=69998399991;
616 a[8][296]=69998399992;
617 a[8][297]=69998399993;
618 a[8][298]=69998399994;
619 a[8][299]=69998399995;
620 a[8][300]=69998399996;
621 a[8][301]=69998399997;
622 a[8][302]=70000000000;
623 a[8][303]=79465000000;
624 a[8][304]=79486799989;
625 a[8][305]=79486799990;
626 a[8][306]=79486799991;
627 a[8][307]=79486799992;
628 a[8][308]=79486799993;
629 a[8][309]=79486799994;
630 a[8][310]=79486799995;
631 a[8][311]=79486799996;
632 a[8][312]=79486799997;
633 a[8][313]=79497400000;
634 a[8][314]=79498399989;
635 a[8][315]=79498399990;
636 a[8][316]=79498399991;
637 a[8][317]=79498399992;
638 a[8][318]=79498399993;
639 a[8][319]=79498399994;
640 a[8][320]=79498399995;
641 a[8][321]=79498399996;
642 a[8][322]=79498399997;
643 a[8][323]=79500000000;
644 a[8][324]=79882536171;
645 a[8][325]=79965000000;
646 a[8][326]=79986799989;
647 a[8][327]=79986799990;
648 a[8][328]=79986799991;
649 a[8][329]=79986799992;
650 a[8][330]=79986799993;
651 a[8][331]=79986799994;
652 a[8][332]=79986799995;
653 a[8][333]=79986799996;
654 a[8][334]=79986799997;
655 a[8][335]=79997400000;
656 a[8][336]=79998399989;
657 a[8][337]=79998399990;
658 a[8][338]=79998399991;
659 a[8][339]=79998399992;
660 a[8][340]=79998399993;
661 a[8][341]=79998399994;
662 a[8][342]=79998399995;
663 a[8][343]=79998399996;
664 a[8][344]=79998399997;
665 a[9][1]=0;
666 a[9][2]=10000000000;
667 a[9][3]=20000000000;
668 a[9][4]=30000000000;
669 a[9][5]=40000000000;
670 a[9][6]=50000000000;
671 a[9][7]=60000000000;
672 a[9][8]=70000000000;
673 a[9][9]=80000000000;
674     
675 }
676 
677 int main()
678 {
679     init();
680     int t,id;long long ans;
681     scanf("%d",&t);
682     for(int cas=1;cas<=t;cas++)
683     {
684         scanf("%d%lld",&d,&x);
685         for(int i=cnt[d];i>=1;i--)
686         if(a[d][i]<=x)
687         {
688             printf("%lld\n",a[d][i]);
689             break;
690         }
691     }
692     return 0;
693 }
View Code

1004Acesrc and Hunting

1005 Acesrc and String Theory

1006 Acesrc and Travel

1007Andy and Data Structure

1008Andy and Maze

1009Calabash and Landlord

https://blog.csdn.net/liufengwei1/article/details/99616268

  1 #include<bits/stdc++.h>
  2  
  3 using namespace std;
  4  
  5 int ans;
  6 struct node
  7 {
  8     int x1,y1,x2,y2;
  9 }a,b;
 10  
 11 inline void prework()
 12 {
 13     scanf("%d%d%d%d",&a.x1,&a.y1,&a.x2,&a.y2);
 14     scanf("%d%d%d%d",&b.x1,&b.y1,&b.x2,&b.y2);
 15 }
 16  
 17 inline void mainwork()
 18 {
 19     if(b.x2<=a.x1 || b.x1>=a.x2 || b.y2<=a.y1 || b.y1>=a.y2)//完全在外部 
 20     {
 21         ans=3;
 22         return;
 23     }
 24     if(a.x1==b.x1 && a.x2==b.x2 && a.y1==b.y1 && a.y2==b.y2)//相等 
 25     {
 26         ans=2;
 27         return;
 28     }
 29     if(a.x1==b.x1 && a.x2==b.x2)    // 两条对边有重合部分 
 30     {
 31         if(b.y1==a.y1 || b.y2==a.y2)
 32         {
 33             ans=3;
 34             return;
 35         }
 36         else
 37         {
 38             ans=4;
 39             return;
 40         }
 41     }
 42     if(a.y1==b.y1 && a.y2==b.y2) // 两条对边有重合部分 
 43     {
 44         if(b.x1==a.x1 || b.x2==a.x2)
 45         {
 46             ans=3;
 47             return;
 48         }
 49         else
 50         {
 51             ans=4;
 52             return;
 53         }
 54     }
 55     if(b.x1<=a.x1 && b.x2>=a.x2 && b.y1<=a.y1 && b.y2>=a.y2)//内涵且只有相邻边重合 
 56     {
 57         ans=3;
 58         return;
 59     }
 60     if(b.x1>=a.x1 && b.x2<=a.x2 && b.y1>=a.y1 && b.y2<=a.y2)//内涵且只有相邻边重合
 61     {
 62         ans=3;
 63         return;
 64     }
 65     if(b.x1>=a.x1 && b.x2<=a.x2)//夹在中间 
 66     {
 67         if(b.y1<=a.y1 && b.y2>=a.y2)
 68         {
 69             if(b.x1==a.x1 || b.x2==a.x2)
 70                 ans=3;
 71             else    
 72                 ans=4;
 73             if(b.y1<a.y1)
 74                 ans++;
 75             if(b.y2>a.y2)
 76                 ans++;
 77         }
 78         else
 79             ans=4;
 80         return;
 81     } 
 82     if(b.y1>=a.y1 && b.y2<=a.y2)//夹在中间 
 83     {
 84         if(b.x1<=a.x1 && b.x2>=a.x2)
 85         {
 86             if(b.y1==a.y1 || b.y2==a.y2)
 87                 ans=3;
 88             else
 89                 ans=4;
 90             if(b.x1<a.x1)
 91                 ans++;
 92             if(b.x2>a.x2)
 93                 ans++;
 94         } 
 95         else
 96             ans=4;
 97         return;
 98     }
 99     ans=4;
100 }
101  
102 inline void print()
103 {
104     printf("%d\n",ans);
105 }
106  
107 int main()
108 {
109     //freopen("i.in","r",stdin);
110     //freopen("i.out","w",stdout); 
111     int t;
112     scanf("%d",&t);
113     for(int i=1;i<=t;i++)
114     {
115         prework();
116         mainwork();
117         print();
118     }
119     return 0;
120 }
View Code
 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cstdlib>
 4 #include<algorithm>
 5 #include<cmath>
 6 #include<cstring>
 7 #include<vector>
 8 #include<queue>
 9 #define pa pair<int,int>
10 #define inf 2000000000
11 #define ll long long
12 using namespace std;
13 int vis[20][20],res[20],T,len;
14 struct Q{
15     int a,b,c,d;
16 }node[3];
17 int id(int x){return lower_bound(res+1,res+1+len,x)-res;}
18 int dx[4]={-1,0,0,1},dy[4]={0,-1,1,0};
19 void dfs(int x,int y)
20 {
21     int i,u,v;
22     vis[x][y]=1;
23     for(i=0;i<4;i++)
24     {
25         u=x+dx[i];
26         v=y+dy[i];
27         if(u>=0&&v>=0&&u<17&&v<17&&vis[u][v]==0) dfs(u,v);
28     }
29 }
30 
31 void work()
32 {
33     len=0;
34     res[++len]=node[1].a;
35     res[++len]=node[1].b;
36     res[++len]=node[1].c;
37     res[++len]=node[1].d;
38     res[++len]=node[2].a;
39     res[++len]=node[2].b;
40     res[++len]=node[2].c;
41     res[++len]=node[2].d;
42     sort(res+1,res+1+len);
43     len=unique(res+1,res+1+len)-res-1;
44     node[1].a=id(node[1].a)<<1;node[1].b=id(node[1].b)<<1;node[1].c=id(node[1].c)<<1;node[1].d=id(node[1].d)<<1;
45     node[2].a=id(node[2].a)<<1;node[2].b=id(node[2].b)<<1;node[2].c=id(node[2].c)<<1;node[2].d=id(node[2].d)<<1;
46 } 
47 
48 int main()
49 {
50     scanf("%d",&T);
51     while(T--)
52     {
53         memset(vis,0,sizeof(vis));
54         scanf("%d%d%d%d",&node[1].a,&node[1].b,&node[1].c,&node[1].d);
55         scanf("%d%d%d%d",&node[2].a,&node[2].b,&node[2].c,&node[2].d);
56         work();
57         for(int i=node[1].a;i<=node[1].c;i++) vis[i][node[1].b]=vis[i][node[1].d]=1;
58         for(int i=node[1].b;i<=node[1].d;i++) vis[node[1].a][i]=vis[node[1].c][i]=1;
59         for(int i=node[2].a;i<=node[2].c;i++) vis[i][node[2].b]=vis[i][node[2].d]=1;
60         for(int i=node[2].b;i<=node[2].d;i++) vis[node[2].a][i]=vis[node[2].c][i]=1;
61 
62         int ans=0;
63         for(int i=0;i<17;i++)
64         {
65             for(int j=0;j<17;j++)
66             {
67                 if(vis[i][j]==0)
68                     dfs(i,j),ans++;
69             }
70         }
71 
72         printf("%d\n",ans);
73     }
74     return 0;
75 }
View Code

1010Quailty and CCPC

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cstdlib>
 4 #include<algorithm>
 5 #include<cmath>
 6 #include<cstring>
 7 #include<vector>
 8 #include<queue>
 9 #define pa pair<int,int>
10 #define inf 2000000000
11 #define ll long long
12 using namespace std;
13 inline int read()
14 {
15     int x=0,f=1;char ch=getchar();
16     while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
17     while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
18     return x*f;
19 }
20 const int maxn=1e5+10;
21 int T,n,d;
22 struct Q{
23  char s[20];
24  int l,r;
25 } q[maxn];
26 bool cmp(Q a,Q b){return a.l==b.l?a.r<b.r:a.l>b.l;}
27 int main()
28 {
29     T=read();
30     while(T--)
31     {
32         n=read();d=read();
33         for(int i=1;i<=n;++i)
34         {
35             scanf("%s",q[i].s);
36             scanf("%d%d",&q[i].l,&q[i].r);
37         }
38         if(d==0){puts("Quailty is very great");continue;}
39         sort(q+1,q+1+n,cmp);
40         int ans,nn=n*d;
41         int cn=nn%10;
42         if(cn==5)
43         {
44             ans=(int)(n*10*d/100)+1;
45             printf("%s\n",q[ans].s);
46         }
47         else puts("Quailty is very great");
48     }
49 
50     return 0;
51 }
View Code

1011Roundgod and Milk Tea

 

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cstdlib>
 4 #include<algorithm>
 5 #include<cmath>
 6 #include<cstring>
 7 #include<vector>
 8 #include<queue>
 9 #define pa pair<int,int>
10 #define inf 2000000000
11 #define ll long long
12 using namespace std;
13 inline ll read()
14 {
15     ll x=0,f=1;char ch=getchar();
16     while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
17     while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
18     return x*f;
19 }
20 const int maxn=1e5+10;
21 ll T,n,x,y;
22 int main()
23 {
24     scanf("%d",&T);
25     while(T--)
26     {
27         scanf("%d",&n);
28         ll ans=0,ans1=0;
29         ll res1=0,res2=0,f;
30         for(int i=1;i<=n;++i)
31         {
32             x=read();y=read();
33             ans1=min(res1,x);
34             x-=ans1;res1-=ans1;
35             ans+=ans1;
36 
37             f=min((ans-ans1),x);
38             res2+=f;x-=f;
39 
40             ans1=min(y,res2);
41             ans+=ans1;
42 
43             y-=ans1;
44             res2-=ans1;
45             res2+=x;
46             res1+=y;
47         }
48 
49         printf("%lld\n",ans);
50 
51     }
52 
53     return 0;
54 }
View Code

 

posted @ 2019-08-15 10:13  StarHai  阅读(418)  评论(0编辑  收藏  举报