当前位置:网站首页>洛谷_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;
}
边栏推荐
- Linux 下安装 redis
- 35 pages dangerous chemicals safety management platform solution 2022 Edition
- Writing of head and bottom components of non routing components
- 数据集-故障诊断:西储大学轴承的各项数据以及数据说明
- Practical series - free commercial video material library
- Ideal car × Oceanbase: when the new forces of car building meet the new forces of database
- Difference between NVIDIA n card and amda card
- Remote connection of raspberry pie by VNC viewer
- Create an interactive experience of popular games, and learn about the real-time voice of paileyun unity
- MySQL基础
猜你喜欢
Connexion à distance de la tarte aux framboises en mode visionneur VNC
How to apply for company email when registering in company email format?
Open Source | Wenxin Big Model Ernie Tiny Lightweight Technology, Accurate and Fast, full Open Effect
Fusion de la conversion et de la normalisation des lots
JDBC practice cases
What experience is there only one test in the company? Listen to what they say
实用系列丨免费可商用视频素材库
Third party payment function test point [Hangzhou multi tester _ Wang Sir] [Hangzhou multi tester]
Realization of mask recognition based on OpenCV
Pytorch里面多任务Loss是加起来还是分别backward?
随机推荐
Develop knowledge points
【OJ】两个数组的交集(set、哈希映射 ...)
Mapper代理开发
[shutter] shutter open source project reference
2022 latest and complete interview questions for software testing
ArrayList分析2 :Itr、ListIterator以及SubList中的坑
The privatization deployment of SaaS services is the most efficient | cloud efficiency engineer points north
Using tensorflow to realize voiceprint recognition
Bean加载控制
可知论与熟能生巧
Intranet penetration | teach you how to conduct intranet penetration hand in hand
[array] binary search
In February 2022, the ranking list of domestic databases: oceanbase regained its popularity with "three consecutive increases", and gaussdb is expected to achieve the largest increase this month
List of major chip Enterprises
Ideal car × Oceanbase: when the new forces of car building meet the new forces of database
JDBC practice cases
Three solutions to frequent sticking and no response of explorer in win11 system
How to apply for company email when registering in company email format?
JDBC練習案例
Convolution和Batch normalization的融合