当前位置:网站首页>Luogu_ P1149 [noip2008 improvement group] matchstick equation_ Enumeration and tabulation
Luogu_ P1149 [noip2008 improvement group] matchstick equation_ Enumeration and tabulation
2022-07-03 00:13:00 【This question AC sleep again】
Luogu _P1149 [NOIP2008 Improvement group ] The matchstick equation _ Enumeration and tabulation
// The meter
#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;
}
// Add comma
#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;
}
边栏推荐
- Interpretation of new plug-ins | how to enhance authentication capability with forward auth
- Xcode real machine debugging
- PR FAQ, what about PR preview video card?
- 95 pages of smart education solutions 2022
- Practical series - free commercial video material library
- RTP 接发ps流工具改进(二)
- CADD course learning (4) -- obtaining proteins without crystal structure (Swiss model)
- Question e: merged fruit -noip2004tgt2
- 流媒体技术优化
- Realization of mask recognition based on OpenCV
猜你喜欢
来自数砖大佬的 130页 PPT 深入介绍 Apache Spark 3.2 & 3.3 新功能
Should you study kubernetes?
Pytorch里面多任务Loss是加起来还是分别backward?
95 pages of smart education solutions 2022
有哪些比较推荐的论文翻译软件?
MATLAB signal processing [Q & a notes-1]
Architecture: load balancing
Realization of mask recognition based on OpenCV
Mapper agent development
[Verilog tutorial]
随机推荐
顶级 DevOps 工具链大盘点
Open source | Wenxin big model Ernie tiny lightweight technology, which is accurate and fast, and the effect is fully open
Use of cocospods
What are the projects of metauniverse and what are the companies of metauniverse
Program analysis and Optimization - 9 appendix XLA buffer assignment
What is the standard format of a 2000-3000 word essay for college students' classroom homework?
sourcetree 详细
MySQL advanced learning notes (III)
開源了 | 文心大模型ERNIE-Tiny輕量化技術,又准又快,效果全開
Angled detection frame | calibrated depth feature for target detection (with implementation source code)
MFC file operation
sysdig分析容器系统调用
[error record] the flutter reports an error (could not resolve io.flutter:flutter_embedding_debug:1.0.0.)
95 pages of smart education solutions 2022
Xcode real machine debugging
JDBC練習案例
JDBC tutorial
Interpretation of new plug-ins | how to enhance authentication capability with forward auth
67页新型智慧城市整体规划建设方案(附下载)
95页智慧教育解决方案2022