原创 百練2456 Aggressive cows&典型二分

2456:Aggressive cows 總時間限制: 1000ms 內存限制: 65536kB 描述 Farmer John has built a new long barn, with N (2

原创 CodeForces - 938D Buy a Ticket

此題可用單源最短路徑來做,不過路徑計算爲2*d+w。配合優先隊列的dij可以不超時地實現。 #include<iostream> #include<cstring> #include<cstdio> #include<queue> us

原创 51Nod - 1035 最長的循環節

正整數k的倒數1/k,寫爲10進制的小數如果爲無限循環小數,則存在一個循環節,求<=n的數中,倒數循環節長度最長的那個數,假如存在多個最優的答案,輸出所有答案中最大的那個數。1/6= 0.1(6) 循環節長度爲11/7= 0.(14285

原创 北大oj&派&浮點數二分

注意浮點數的放大處理!!#include<iostream> #include<cstdio> using namespace std; const int maxn=10005; const int inf=100000; cons

原创 poj1013 Counterfeit Dollar 稱硬幣

#include<iostream> #include<cstring> #include<cstdio> using namespace std; bool ok(char p[3][3][10],int w,char ch)

原创 char數組的賦值操作&動態儲存建立刪除

一.字符數組的賦值問題 1.對單個元素進行賦值  char s[5]; s[0]='g'; s[1]='o'; s[2]='o'; s[3]='d'; PS:當檢查到'\0'時,就認爲一個字符串結束了。 2.用串常量初始化。 char