当前位置:网站首页>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;
}
边栏推荐
- MFC gets the current time
- ArrayList分析2 :Itr、ListIterator以及SubList中的坑
- 流媒体技术优化
- TypeError: Cannot read properties of undefined (reading ***)
- Speech recognition Series 1: speech recognition overview
- [Verilog tutorial]
- PR FAQ, what about PR preview video card?
- JDBC practice cases
- maya渔屋建模
- leetcode 650. 2 keys keyboard with only two keys (medium)
猜你喜欢
Additional: token; (don't read until you finish writing...)
67 page overall planning and construction plan for a new smart city (download attached)
洛谷_P2010 [NOIP2016 普及组] 回文日期_折半枚举
How to set automatic reply for mailbox and enterprise mailbox?
JS interviewer wants to know how much you understand call, apply, bind no regrets series
Bean load control
QT 如何将数据导出成PDF文件(QPdfWriter 使用指南)
Is the multitasking loss in pytoch added up or backward separately?
Mutual exclusion and synchronization of threads
95页智慧教育解决方案2022
随机推荐
Returns the maximum distance between two nodes of a binary tree
流媒体技术优化
Explain in detail the process of realizing Chinese text classification by CNN
[array] binary search
Maybe you read a fake Tianlong eight
[error record] the flutter reports an error (could not resolve io.flutter:flutter_embedding_debug:1.0.0.)
QT 如何将数据导出成PDF文件(QPdfWriter 使用指南)
leetcode 650. 2 keys keyboard with only two keys (medium)
SQL query statement parameters are written successfully
Leetcode DP three step problem
监控容器运行时工具Falco
TypeError: Cannot read properties of undefined (reading ***)
Which software can translate an English paper in its entirety?
The privatization deployment of SaaS services is the most efficient | cloud efficiency engineer points north
[Verilog tutorial]
A single element in an ordered array -- Valentine's Day mental problems
How to set automatic reply for mailbox and enterprise mailbox?
How QT exports data to PDF files (qpdfwriter User Guide)
Open source | Wenxin big model Ernie tiny lightweight technology, which is accurate and fast, and the effect is fully open
开源了 | 文心大模型ERNIE-Tiny轻量化技术,又准又快,效果全开