hdu-1128(數學問題,篩數)
題目連結:http://acm.hdu.edu.cn/showproblem.php?pid=1128
思路:從0,開始,每次求一個數x的d(x),然後判斷如果x沒有標記,則說明x沒有由任意一個d(i)(i<=x)組成,因為d(x)是遞增的。
#include<iostream> #include<cstdio> using namespace std; const int maxn = 1000000; int vis[maxn+10]={0}; int main(void) { int i,j,ans; for(i=0;i<=maxn;i++) { ans=i;j=i; while(j) { ans+=j%10; j/=10; } vis[ans]=1; if(!vis[i]) printf("%d\n",i); } return 0; }
相關推薦
hdu-1128(數學問題,篩數)
題目連結:http://acm.hdu.edu.cn/showproblem.php?pid=1128 思路:從0,開始,每次求一個數x的d(x),然後判斷如果x沒有標記,則說明x沒有由任意一個d(i)(i<=x)組成,因為d(x)是遞增的。 #include<iostream>
2016女生賽 HDU 5710 Digit-Sum(數學,思維題)
accep ger sizeof memory fin left total src view Digit-Sum Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Oth
Atlantis HDU - 1542 (掃描線,線段樹)
stack 是我 opera 分享 print 之前 roo size oot 掃描線的模板題,先把信息接收,然後排序,記錄下上邊和下邊,然後用一條虛擬的線從下往上掃。如果我掃到的是下邊,那麽久用線段樹在這個區間內加上1,表示這個區間現在是有的,等我掃描到上邊的時候在加上-
【CodeForces - 349B】Color the Fence (貪心,填數)
題幹: Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks
【CodeForces - 215B 】Olympic Medal (數學,公式推導)
題幹: The World Programming Olympics Medal is a metal disk, consisting of two parts: the first part is a ring with outer radius of r1 cm,
215B 】Olympic Medal (數學,公式推導)
題幹: The World Programming Olympics Medal is a metal disk, consisting of two parts: the first part is a ring with outer radius of r1 cm, i
【codeforce】-#669A-Little Artem and Presents(數學,找規律)
A. Little Artem and Presents time limit per test 2 seconds memory limit per test 256 me
POJ 2478 歐拉函數(歐拉篩法) HDU 1576 逆元求法
ios size col add 求和 。。 結果 names const 相關逆元求法,我之前有寫過,還有歐拉函數的求法,歐拉函數與逆元的關系 點擊POJ 2478又是一個打表的題目,一眼看出結果就是前n個歐拉函數值的和。這裏直接計算歐拉函數值求和會超時,看見多組數據。
洛谷P2158儀仗隊(數學,觀察找規律,歐拉函數)
show 找規律 == += 數值 std pro tchar urn 題目鏈接:https://www.luogu.org/problemnew/show/P2158 讀完題被嚇到了,這是什麽東西。 總之,需要觀察+找規律啊!觀察可以發現,從第三行開始,第i行中當前直
hdu-1124(數學問題,求n!的尾零的個數)
題目連結:http://acm.hdu.edu.cn/showproblem.php?pid=1124 思路:每五個數1個0,5個5就2個0(不用管2,一定充足) #include<iostream> #include<cstdio> #include<cmath>
A】無序組數 (思維,數學,因子個數)
題幹: 時間限制:C/C++ 1秒,其他語言2秒 空間限制:C/C++ 131072K,其他語言262144K 64bit IO Format: %lld 題目描述 給出一個二元組(A,B) 求出
隨機圖片滾動(隨機數+變化函數),可運行
圖片 relative position parent border <!doctype html><html lang="en"><head><meta charset="UTF-8"><title>隨機圖片滾動</tit
[2017浙工大之江學院決賽 L] qwb與整數對(離線,篩)
online con ons print include main amp i++ max 題目鏈接:http://115.231.222.240:8081/JudgeOnline/problem.php?cid=1005&pid=11 這題不會,看了檸檬巨的題解才
HDU 1134 Game of Connections(卡特蘭數)
cut res ras sam eof cpp ont des tel 題目代號:HDU 1134 題目鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=1134 Game of Connections Time Limit: 200
HDU 6050 17多校2 Funny Function(數學+乘法逆元)
for each -- pac 目前 .cn ron rst input style Problem Description Function Fx,ysatisfies:For given integers N and M,calculate Fm,1 modulo 1e
1305 Pairwise Sum and Divide(數學 ,規律)
sum content %d sort bar mco retext 但是 clu HackerRank 1305 Pairwise Sum and Divide 有這樣一段程序,fun會對整數數組A進行求值,其中Floor表
mysql--補充(視圖,觸發器,事務,存儲過程,函數)
del 三種方式 定位 問題 cmd 基本 流程 保留 獲取 一:視圖 視圖是一個虛擬表(非真實存在),其本質是【根據SQL語句獲取動態的數據集,並為其命名】,用戶使用時只需使用【名稱】即可獲取結果集,可以將該結果集當做表來使用。 使用視圖我們可以把查詢過程中的臨時表
HDU 6216 A Cubic number and A Cubic Number(數學/二分查找)
define 2-2 floor ons ostream 題意 iostream int esp 題意: 給定一個素數p(p <= 1e12),問是否存在一對立方差等於p。 分析: 根據平方差公式: 因為p是一個素數, 所以只能拆分成 1*p, 所以 a-b = 1
HDU 1395 2^x mod n = 1 (歐拉函數)
ear val clu pro ava http align 歐拉 similar 2^x mod n = 1 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other
vue打包後出現靜態資源|(圖片,json數據)找不到路徑
CP 解決 png 路徑 分享圖片 分享 com 奇跡 public 最近在學習Vue是如何編寫項目的,在踩了許多坑後,終於要到了最後一步npm run build了,很開心的等待奇跡,然後打包後出現了找不到圖片路徑的問題。 解決辦法:1.將圖片或者json數據文件夾放到s