当n等于42时,答案是88139吗?

P1149 [NOIP2008 提高组] 火柴棒等式

~~39702~~
by 派大那个星 @ 2018-08-15 14:39:46


emmm因为~~太大~~跑不出来
by 派大那个星 @ 2018-08-15 14:48:13


感觉差不多
by 派大那个星 @ 2018-08-15 14:50:07


应该是37116吧
by 作死成功了 @ 2018-08-19 11:28:49


``` #include<stdio.h> int main() { int n; scanf("%d",&n); if(n==1)printf("0"); else if(n==13)printf("1"); else if(n==15)printf("8"); else if(n==20)printf("39"); else printf("128"); return 0; } ```
by AKIOIAKIOI @ 2018-09-01 17:58:45


太大跑不动2333
by LamoJunity @ 2018-09-04 20:41:25


```cpp #include<iostream> #include<cmath> #include<cstring> #include<string> #include<cstdio> #include<cstdlib> using namespace std; int hcb[10] = {6,2,5,5,4,5,6,3,7,6}; int cnt; void jisuan(int A,int B,int n) { int C = A + B; do { n -= hcb[A % 10]; A /= 10; }while (A > 0); do { n -= hcb[B % 10]; B /= 10; }while (B > 0); do { n -= hcb[C % 10]; C /= 10; }while (C > 0); if (!n) ++cnt; } void digui(int n,int A,int B,int end) { for (int w = 0; w != 1111111; ++w) { if (end == 0) { digui(n,w,0,1); } else { jisuan(A,w,n); } } } int main() { int n; cin >> n; n -= 4; if (n <= 0) { cout << "0"; return 0; } digui(n,0,0,0); cout << cnt; system("pause"); } ``` 这样绝对跑的出来,但是会很慢
by LamoJunity @ 2018-09-04 20:42:24


|