当前位置:网站首页>洛谷_P1149 [NOIP2008 提高组] 火柴棒等式_枚举打表
洛谷_P1149 [NOIP2008 提高组] 火柴棒等式_枚举打表
2022-07-02 22:53:00 【这题AC再睡.】
洛谷_P1149 [NOIP2008 提高组] 火柴棒等式_枚举打表


// 打表
#include<bits/stdc++.h>
using namespace std;
const int N=99999;
// 0 1 2 3 4 5 6 7 8 9 10 11 12
int mp[N]={ 6,2,5,5,4,5,6,3,7,6, 8,4,7 };
void init()
{
int i,t,sum;
for( i=10;i<N;i++ )
{
t=i; sum=0;
while( t ) { sum+=mp[t%10]; t/=10; }
mp[i]=sum;
}
}
int main()
{
init();
int n,i,j,k,sum,ans;
while( cin>>n )
{
for( k=0;k<=24;k++ )
{
ans=0; // pos
for( i=0;i<N/2;i++ )
for( j=0;j<N/2;j++ )
{
sum=mp[i]+mp[j]+mp[i+j]+4;
if( sum==k ) ans++;
}
cout<<ans<<" ";
}
}
return 0;
}
// 添加逗号
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
while( cin>>n )
{
cout<<n<<",";
}
return 0;
}
//
#include<bits/stdc++.h>
using namespace std;
const int ans[]={ 0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,8,9,6,9,29,39,38,65,88,128 };
int main()
{
int n;
while( cin>>n )
{
cout<<ans[n]<<endl;
}
return 0;
}边栏推荐
- Chinatelecom has maintained a strong momentum in the mobile phone user market, but China Mobile has opened a new track
- How can cross-border e-commerce achieve low-cost and steady growth by laying a good data base
- Returns the root node of the largest binary search subtree in a binary tree
- Convolution和Batch normalization的融合
- @How to use bindsinstance in dagger2
- Realization of mask recognition based on OpenCV
- JDBC practice cases
- SharedPreferences save list < bean > to local and solve com google. gson. internal. Linkedtreemap cannot be cast to exception
- MySQL advanced learning notes (III)
- Many to one, one to many processing
猜你喜欢

JDBC practice cases

130 pages of PPT from the brick boss introduces the new features of Apache spark 3.2 & 3.3 in depth
![[ml] Li Hongyi III: gradient descent & Classification (Gaussian distribution)](/img/75/3f6203410dd2754e578e0baaaa9aef.png)
[ml] Li Hongyi III: gradient descent & Classification (Gaussian distribution)

2022 latest and complete interview questions for software testing

Maybe you read a fake Tianlong eight

Mapper agent development

Improvement of RTP receiving and sending PS stream tool (II)

67 page overall planning and construction plan for a new smart city (download attached)

JSON data transfer parameters

流媒体技术优化
随机推荐
Chinatelecom has maintained a strong momentum in the mobile phone user market, but China Mobile has opened a new track
基于OpenCV实现口罩识别
Returns the size of the largest binary search subtree in a binary tree
[Verilog tutorial]
Difference between NVIDIA n card and amda card
RTP 接发ps流工具改进(二)
Remote connection of raspberry pie by VNC viewer
Request and response
yolov5test. Py comment
Data set - fault diagnosis: various data and data description of bearings of Western Reserve University
Detailed explanation of 'viewpager' in compose | developer said · dtalk
"A good programmer is worth five ordinary programmers!"
130 pages of PPT from the brick boss introduces the new features of Apache spark 3.2 & 3.3 in depth
MFC 获取当前时间
Writing of head and bottom components of non routing components
Using tensorflow to realize voiceprint recognition
接口自动化覆盖率统计——Jacoco使用
采用VNC Viewer方式远程连接树莓派
How to set automatic reply for mailbox and enterprise mailbox?
Wechat applet basic learning (wxss)