当前位置:网站首页>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;
}
边栏推荐
- 【硬记】脏读、不可重复读、幻读场景核心区别
- Nfv basic overview
- 基于FPGA的ds18b20温度传感器使用
- Uploading and retrieving stored images in localstorage
- 关于c#委托、事件相关问题
- How to write an amazing design document?
- SDN基本概述
- Raspberry school advanced development - "writing of IO port driver code" includes bus address, physical \u virtual address and bcm2835 chip manual knowledge
- Through the function seaborn cubehelix_ Palette build order palette
- Tidb statistics
猜你喜欢

RT thread simulator lvgl control: slider control

Normalizing y-axis in histograms in R ggplot to proportion

线程池中的 工作线程如何被回收

redis-7. Redis master-slave replication, cap, Paxos, cluster sharding cluster 02

redis-4. Redis' message subscription, pipeline, transaction, modules, bloom filter, and cache LRU

Priority analysis of list variables in ansible playbook and how to separate and summarize list variables

redis-1. Install redis with pictures and texts

FSM状态机

oracle问题,字段里面的数据被逗号隔开,取逗号两边数据

Tree list under winfrom treelist related
随机推荐
量化框架backtrader之一文讀懂Analyzer分析器
Simple understanding of basic language of C language
Micro isolation (MSG)
c#高级编程-特性篇
C # using multithreading
2022 - 06 - 12: dans un échiquier carré n * N, il y a n * n pièces, donc chaque pièce peut avoir exactement une pièce. Mais maintenant quelques pièces sont rassemblées sur une grille, par exemple: 2 0
个人js学习笔记
Tidb grafana reverse proxy
Calculate running total / running balance
Nfv basic overview
redis-6. Redis master-slave replication, cap, Paxos, cluster sharding cluster 01
【转】FPGA面试题
Upper computer development (code debugging of firmware download software)
RT thread simulator lvgl control: switch switch button control
【ViveFocus使用WaveVR插件获取手柄操作事件】
Real time lighting of websocket server based on esp32cam
Xuanwu cloud technology passed the listing hearing: the performance fluctuated significantly, and chenyonghui and other three were the controlling shareholders
. Net code to implement get request and post request
Sharp weapon tcpdump
[Markov chain Monte Carlo] Markov chain Monte Carlo method sampling prior distribution