[Blue Bridge Cup] with fractions
Peak memory consumption < 64M CPU consumption < 3000ms
"Title Description-Problem Description"
100 can be expressed as a fractional form: 100 = 3 + 69258/714
can also be represented as: 100 = 82 + 3546/197
Note features: With fractions, the digital 1~9 appear only once (not including 0).
Similar to the band score, 100 has 11 notation.
"Input sample 1-sample input 1" |
"Output sample 1-sample outputs 1" |
100 |
11 |
"Input sample 2-sample input 2" |
"Output sample 2-sample outputs 2" |
105 |
6 |
Exercises
Probably estimated the limit calculation of the table, 1s should barely can take a chance, and then looked back to see the time to 3s ...
The brain immediately terminates the thinking of other solutions ...
"Code C + +"
#include <cstdio>#include<algorithm>#defineMX 1000005intdata[9], opt[mx];intReadintLintR) {//[L, R] ints =0; for(; L <= R; ++L) {s= S *Ten+Data[l]; } returns;}intMain () {intI, AL, AR, BL, BR, A, B, C; for(i =0; I <9; ++i) Data[i] = i +1; Do{ for(Al = AR =0; Ar <=6; ++ar) {a=Read (AL, AR); for(bl = BR = AR +1; BR-BL +1<8-BL; ++R) {b= Read (BL, br), C = Read (BR +1,8); if(C/b*b! = c)Continue; if(A + c/b < MX) ++opt[a + c/b]; } } } while(Std::next_permutation (data, Data +9)); scanf ("%d", &i); printf ("%d", Opt[i]); return 0;}
"Measurable Address" http://acmore.cc/problem.php?id=1596
[Blue Bridge Cup] with fractions