当前位置:网站首页>B. I hate 1111 (mnemonic search number theory
B. I hate 1111 (mnemonic search number theory
2022-06-13 07:18:00 【lcxdz】
Add link description
You can find the high order 1111 It can be done by 11 perhaps 111 form Then judge whether it can be 11 to be divisible by Or subtract 111 Regrouping
Memorize mp Whether storage can consist of
#include<bits/stdc++.h>
using namespace std;
map<int,bool>mp;
int dfs(int u){
if(mp.count(u))return mp[u];
int mx=0;
for(int i=11;i<=u;i=i*10+1){
mx=i;
}
for(int i=mx;i>=11;i=i/10){
// It's a small judgment
// cout<<i<<"\n";
if(dfs(u-i)){
mp[u]=1;
return mp[u];
}
}
return mp[u];
}
int main(){
int T;
cin>>T;
while(T--){
mp[0]=1;// first 0 Is divisible
int x;
cin>>x;
if(dfs(x))cout<<"YES\n";
else cout<<"NO\n";
}
return 0;
}
边栏推荐
- Tidb index optimization
- redis-5. Redis' RDB, fork, copyonwrite, AOF, RDB & AOF are mixed
- It's called the next generation monitoring system. Let's see how awesome it is
- I always don't understand the high address and high position
- RT-Thread 模拟器 simulator LVGL控件:button 按钮事件
- ISIS的vsys(虚拟系统)
- Test development programmers, are you still confused? You can't define yourself as a yard farmer
- 对绘制丘岭密度图ridge plot的详细说明、重叠核密度估计曲线overlapping densities、FacetGrid对象、函数sns.kdeplot、函数FacetGrid.map
- powerdisgner逆向生成oracle数据模型
- 基于ESP32CAM实现WebSocket服务器实时点灯
猜你喜欢
The password does not take effect after redis is set
Nfv basic overview
RT-Thread 模拟器 simulator LVGL控件:button 按钮样式
Tidb statistics
redis-5. Redis' RDB, fork, copyonwrite, AOF, RDB & AOF are mixed
Reflection of C # Foundation
Tidb grafana reverse proxy
RT thread simulator lvgl control: button button style
RT-Thread 模拟器 simulator LVGL控件:slider 控件
C#合并多个richtextbox内容时始终存在换行符的解决方法
随机推荐
Database connection under WinForm
Evolution in the digital age
How to solve the 404 problem
TXT_ File encryption and compression
Tidb server tuning
Detailed description of drawing ridge plot, overlapping densities of overlapping kernel density estimation curve, facetgrid object and function sns Kdeplot, function facetgrid map
Ticdc introduction
部署RDS服务
Relevant knowledge under WinForm
Br backup test
Is it safe to open an account online in Hangzhou?
What does my financial product mean in clearing?
C drawing table and sending mail function
DM Experiment 6: filter replication
Simple understanding of basic language of C language
Tikv key performance parameters and optimization
考研英语
同花顺可以开股票账户吗?安全吗?
Upper computer development (software test of firmware download software)
Nfv basic overview