原创 字符串刪除特定字符

感覺挺新穎的想法,記下來吧 void delete_char(char str[],char target){ int i,j; for(i=j=0;str[i]!='\0';i++){ if(str[i]!=target){

原创 Ancient Messages(uva1103)DFS

  理解起來簡直費死勁,腦洞大開的一題 輸入的是16進制數,需要轉化成2進制數才能繼續求解。這道題有一點很麻煩就是輸入的圖形可以是拉伸之後的圖形。在這種情況之下,我們必須通過一些特徵值來判斷圖形。我們發現,每個文字的“洞”的個數是

原创 to-string()函數(將數字轉化成對應的字符串)

小技巧,用法 cin >> n; string str,t; t = to_string(n); 頭文件爲#include<string> 點贊 收藏 分享 文章舉報 ICPC

原创 Codeforces Round #618 (Div. 2) C. Anu Has a Function(位運算)

Anu has created her own function ff : f(x,y)=(x|y)−yf(x,y)=(x|y)−y where || denotes the bitwise OR operation. For examp

原创 牛客寒假算法基礎集訓營1(G 小a的排列 )模擬

小a的排列 https://ac.nowcoder.com/acm/contest/317/G #include<cstdio> #include<cstdlib> #include<iostream> #include<cmath>

原创 牛客寒假算法基礎集訓營3(D 處女座的訓練)基礎貪心

https://ac.nowcoder.com/acm/contest/329/D #include <iostream> #include <cstdio> #include <fstream> #include <algorithm

原创 Ordering Tasks (uva10305)(DFS判斷有向環)(拓撲排序)

原題目: John has n tasks to do. Unfortunately, the tasks are not independent and the execution of one task is only possibl

原创 牛客寒假算法基礎集訓營1(B 小a與"204&quot)

鏈接:https://ac.nowcoder.com/acm/contest/317/B 來源:牛客網 樣例: 3 2 0 4 輸出: 36   樣例2解釋:按(4,0,2)排列是最優的,此時sum=(4−0)2+(0−4)2+(2−0)

原创 2020牛客寒假算法基礎集訓營4 C子段乘積 (尺取法+逆元)

https://ac.nowcoder.com/acm/contest/3005/C 數學知識: 尺取法:l代表左端點,r代表右端點。l先不動,r往前掃描,如果成功掃到,有k個非0元素的子段就累成起來,最後把最左端的元素除了,左端點往前移

原创 牛客寒假算法基礎集訓營1(D 小a與黃金街道 )數論

https://ac.nowcoder.com/acm/contest/317/D #include<iostream> #include<string.h> #include<algorithm> #include<queue> us

原创 Abbott's Revenge (uva816)BFS+最短路(ACM/ICPC World Final 2000 A)

原題目: The 1999 World FinalsContest included a problem based on a “dicemaze.” At the time the problem was written, the ju

原创 Sudoku Killer(數獨類問題)

自從2006年3月10日至11日的首屆數獨世界錦標賽以後,數獨這項遊戲越來越受到人們的喜愛和重視。 據說,在2008北京奧運會上,會將數獨列爲一個單獨的項目進行比賽,冠軍將有可能獲得的一份巨大的獎品———HDU免費七日遊外加lcy親筆簽名

原创 牛客寒假算法基礎集訓營2(G 處女座與復讀機 )(DP||DFS||模擬)

https://ac.nowcoder.com/acm/contest/327/G 三種方法 dfs實現(完全沒想到這個還能dfs) #include<bits/stdc++.h> using namespace std; string

原创 牛客寒假算法基礎集訓營1(C 小a與星際探索) 基礎DP

https://ac.nowcoder.com/acm/contest/317/C #include<iostream> #include<string.h> #include<algorithm> #include<queue> us

原创 Codeforces Round #620 (Div. 2) C. Air Conditioner(集合之間的並區間)

http://codeforces.com/contest/1304/problem/C 大意: 給你兩個數n,m,n表示有幾個顧客,m表示初始房間溫度 n行輸入,t,l,h,t表示顧客待在房間時間,l表示顧客能接受的最低溫度,t表示顧客