Time of Update: 2018-12-05
#include <cstdio>#include <cstdlib>#include <cstring>#include <queue>#include <iostream>//#define INPUT//#define DBG/** Problem:POJ2488 Begin Time:8th/Mar/2012 1:30 p.m. End Time:2012-03-08 21:08:53 Test
Time of Update: 2018-12-05
#include <stdio.h>#include <string.h>char web[10000][75];int main(){ char command[10]; int i = 0,j; memset(web,'\0',sizeof(web)); while(1){ scanf("%s",command); if(command[0] == 'V'){ i++;
Time of Update: 2018-12-05
快速冪乘用的是二分的思想a^b%c,當b比較大時可將其分解當b為偶數時,a^b%c=(a^(b/2)*a^(b/2))%c;當b為奇數時,a^b%c=(a^(b/2)*a^(b/2)*a)%cAOJ-569-乘的更快http://icpc.ahu.edu.cn/OJ/Problem.aspx?id=569赤裸裸的快速冪乘#include<stdio.h>#include<string.h>#include<stdlib.h>#define Mod 99991_
Time of Update: 2018-12-05
今天把去年成都的網路賽做了一下,去年是一題不會哇,現在也挺吃力,還有幾題不會,有空再來看Attackhttp://acm.hdu.edu.cn/showproblem.php?pid=4031樹狀數組,這題樹狀數組節點n記錄的是wall[n]和wall[n-1]被炮擊的差#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>using namespace
Time of Update: 2018-12-05
8數位問題,即在一個3×3的矩陣中有8個數(1至8)和一個空格,從一個狀態轉換到另一個狀態,每次只能移動與空格相鄰的一個數字到空格當中AOJ-417-8數位http://icpc.ahu.edu.cn/OJ/Problem.aspx?id=417這題是求轉化的最少步數,可用BFS解決,共有9!=362880種情況,關鍵是如何標記已經訪問過的狀態,保證每次搜尋得到的狀態都是最小的步數,這裡可將字串轉化成對應的整數來處理,可用康托展開來節省儲存空間康托展開: X=an*(n-1)!+an-1*(n-
Time of Update: 2018-12-05
/* 寢室學弟問我一個很簡單的問題,就是把一個數逆序後輸出的字串轉換為數值,學弟用了pow這個很常見的函數,代碼邏輯沒有問題,但是不理解為什麼答案是錯的,而且只差1或者2;在小蒙的協助下,才開始意識到pow 精度丟失的問題.一查 cplusplus.com 才發現 如下問題: double pow ( double base, double exponent );long double pow ( long double base, long double
Time of Update: 2018-12-05
//A 好久沒做了,5.1一過寢室不熄燈了,今天做了一場還是只做了2題。 弱。#include<iostream>#include<stdio.h>using namespace std;int a[200005],b[200005];int main(){ // freopen("1.txt","r",stdin); int n,m,numx=0,numy=0,x,y; cin>>n>>m; for(int i=0;
Time of Update: 2018-12-05
#include <cstring>#include <cstdio>#include <cstdlib>#include <algorithm>#include <iostream>//#define INPUTusing namespace std;/** Problem : poj1011 - Sticks Begin Time : 13:00 p.m. 15th/mar/2012 End Time : 15:1
Time of Update: 2018-12-05
HDU-1671-Phone Listhttp://acm.hdu.edu.cn/showproblem.php?pid=1671字典樹,判斷是否有某個數字是另一個數位首碼,注意123不是123的首碼,建樹之後要刪除節點,否則會Memory LimitExceeded寫的比較麻煩,分兩種情況,一是先出現123,再出現1234,;二是先出現1234,再出現123#include<iostream>#include<cstdio>#include<cstring>
Time of Update: 2018-12-05
#include <iostream>#include <cstring>#include <cstdlib>#include <cstdio>using namespace std;/** c0de4fun聲明:本人未給出測試資料、未聲明一次AC的題均為參考解題報告自己寫的。 對那些無私貢獻的大神真誠的致敬!本題的測試資料可以看最後面 Problem: HDU4313 - Matrix
Time of Update: 2018-12-05
#include <cstdlib>#include <cstdio>#include <cstring>#include <iostream>#include <time.h>using namespace std;const int HEAPSIZE = 10;int heap[HEAPSIZE + 1];int MAKEHEAP(int i ,int size){ int child,rootkey,tmp; tmp
Time of Update: 2018-12-05
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=586#include <cstdio>#include <cstring>#define MAX 1000000int Edge[1010][1010];int adapter[1010];int lowcost[1010];int t,n;void init( ){int i, k;scanf( "%d", &n );for( i = 0;
Time of Update: 2018-12-05
#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;#define inf 10000000#define maxn 21int m,n;int edge[maxn][maxn],lowcost[maxn],nearvex[maxn];void prim(int u0){ int i,j; int
Time of Update: 2018-12-05
B. Hungry Sequencetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIahub and Iahubina went to a date at a luxury restaurant. Everything went fine until paying for the food. Instead of money, the
Time of Update: 2018-12-05
#include <cstdlib>#include <cstdio>#include <cstring>#include <algorithm>#include <queue>using namespace std;/** Problem : UVA11205 - The broken pedometer Begin Time: 28th/Mar/2012 11:30 a.m. Finish Time:
Time of Update: 2018-12-05
#include <cstring>#include <cstdlib>#include <cstdio>#include <iostream>#define INPUT/**Problem : poj3009看別人的報告過得,代碼基本上相同,因為實在不會了Begin Time: 11th/3/2012 7:28 p.m.End Time: 11th/3/2012 11:10
Time of Update: 2018-12-05
#include <iostream>#include <cstring>#include <cstdlib>#include <cstdio>using namespace std;const int MAXN = 100;const int MAXM = 1100;int maze[MAXN][MAXM];int dp[MAXN][MAXM];int solve(int n,int m,int N,int
Time of Update: 2018-12-05
#include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>#include <queue>using namespace std;const int MAX_SIZE = 1000100;/** 【0.9%】SPOJ7758 Grwoing Strings 解題報告 + AC代碼 + 思路 + AC自動機簡短總結
Time of Update: 2018-12-05
#include <cstdio>#include <cstdlib>#include <cstring>#include <iostream>//#define INPUT/** Problem:1182 - 食物鏈,NOI2001 Begin Time:4th/Mar/2012 1:00 p.m. End Time:4th/Mar/2012 6:47 p.m. Cost Time:兩天多,看的別人的解題報告AC的
Time of Update: 2018-12-05
poj 1988num是統計該堆中cube的數目ans是統計該cube下面的cube的數目代碼如下:#include<iostream>using namespace std;#include<cstdio>const int maxn=50005;int pre[maxn],num[maxn],ans[maxn];void init(){ int i; for(i=0;i<maxn;i++){ pre[i]=i;