Time of Update: 2018-12-05
#include<stdio.h>int n,q;int jk[25][4];int state[25];int result[25];void initial(){ int i,j; for(i=0; i<25; i++) { for(j=0; j<4; j++) jk[i][j]=0; state[i]=0; result[i]=0; } q=0;}int dfs(int
Time of Update: 2018-12-05
題目連結:http://www.programming-challenges.com/pg.php?page=studenthome/* The 3n+1 problem 計算每個數的迴圈節長度,求給定區間的迴圈節長度的最大值。*/#include<iostream>#include<stdio.h>using namespace std;int jk(int n){ int num=1; while(n!=1) {
Time of Update: 2018-12-05
/* Minesweeper WA了n次才知道uva格式錯了也返回wa沒有pe啊尼瑪*/#include<iostream>#include<stdio.h>#include<string.h>using namespace std;char a[105][105];int main(){ int i,j,n,m,x=0; //freopen("./pcio/110102.inp","r",stdin);
Time of Update: 2018-12-05
//cf #163 div 2 A// http://codeforces.com/contest/266/problem/A#include<stdio.h>#include<iostream>using namespace std;char a[55];int main(){ int n,i; //freopen("input.txt","r",stdin); while(scanf("%d%*c",&n)!=EOF){ int
Time of Update: 2018-12-05
#include <iostream>#include <set>using namespace std;int main(){ set<int>set1; for(int i=9; i>0; i--) set1.insert(i); //有序插入 set1.erase(3); for(set<int>::iterator p=set1.begin(); p!=set1.end(); ++p)
Time of Update: 2018-12-05
#include <stdio.h>#include <stdlib.h>#include <string.h>#define max(x,y) x>y?x:y;int v[100001];int w[100001];int dp[100001];int main(){ int n,m; // freopen("input.txt","r",stdin); while(scanf("%d",&n)!=EOF) {
Time of Update: 2018-12-05
// div2 A#include <stdio.h>int main(){ int i,j,n,T; scanf("%d",&T); while(T--){ scanf("%d",&n); if(n>=180||n<=0){ printf("NO\n"); continue; } if (360%(180-n)==0)
Time of Update: 2018-12-05
逆序對數 時間限制:1 秒 空間限制:65536 KB 在一個排列中,如果一對數的前後位置與大小順序相反,即前面的數大於後面的數,那麼它們就稱為一個逆序。一個排列中逆序的總數就稱為這個排列的逆序數。如2 4 3 1中,2 1,4 3,4 1,3 1是逆序,逆序數是4。給出一個整數序列,求該序列的逆序數。Input第1行:N,N為序列的長度(n <= 50000)第2 - N + 1行:序列中的元素(0 <= A[i] <= 10^9)Output輸出逆序數Input 樣本 42
Time of Update: 2018-12-05
// 鄰接矩陣#include<stdio.h>#include<string.h>#define MAXN 100int Edge[MAXN][MAXN];int main(){ // freopen("input.txt","r",stdin); // freopen("output.txt","w",stdout); int m,n,i,j,id,od,u,v; while(scanf("%d%d",&n,&m)!=EOF)
Time of Update: 2018-12-05
HDU-1160-FatMouse's Speedhttp://acm.hdu.edu.cn/showproblem.php?pid=1160對體重從小到大排序,要求體重越小,速度越快,找一個最長遞增子序列即可#include<stdio.h>#include<string.h>#include<stdlib.h>struct cam{int x;int y;int num;}list[1005];int dp[1005],pre[1005];int cmp(
Time of Update: 2018-12-05
// zoj 2110 #include<stdio.h>#include<math.h>char map[9][9];int m,n,t;int di,dj;bool escape;int dir[4][2]={{0,-1},{0,1},{1,0},{-1,0}};void dfs(int si,int sj,int cnt){ int i,temp; if(si>n||sj>m||si<=0||sj<=0)
Time of Update: 2018-12-05
N個整數組成的序列a[1],a[2],a[3],…,a[n],求該序列如a[i]+a[i+1]+…+a[j]的連續子段和的最大值。當所給的整數均為負數時和為0。例如:-2,11,-4,13,-5,-2,和最大的子段為:11,-4,13。和為20。Input第1行:整數序列的長度N(2 <= N <= 50000)第2 - N + 1行:N個整數(-10^9 <= A[i] <= 10^9)Output輸出最大子段和。Input
Time of Update: 2018-12-05
#include<stdio.h>int main(){ // freopen("1.txt","r",stdin); int n,h,m,s,h1,m1,s1; scanf("%d",&n); while(n--) { int h2=0,m2=0,s2=0; scanf("%d:%d:%d %d:%d:%d",&h,&m,&s,&h1,&m1,&s1);
Time of Update: 2018-12-05
選擇解壓版的Tomcat的理由是可以讓我們使用多個Tomcat,但是配置上就會出現一些問題,需要我們手動變更配置。我的Tomcat版本是:apache-tomcat-6.0.16.zip給個連結:http://tomcat.apache.org/download-60.cgi下載完成後,解壓到C:\Tomcat6(設定你的路徑),檢查環境變數JAVA_HOME是否存在:一般JDK安裝時會自動化佈建,如果沒有就建立,JAVA_HOME的值設為JDK的安裝根路徑。環境變數位置:我的電腦 ->
Time of Update: 2018-12-05
演算法原理:數組a[]為待處理數組f[]用於記錄a[]數組中,以對應位置資料為結尾的最長有序序列長度p[]用於記錄a[]數組中,以對應位置資料為結尾的前一個資料位元置使用position記錄最大長度位置以a[]={1,4,7,2,5,8,3,6,9},計算最長遞增有序子序列為例初始化f[]={1, 1, 1, 1, 1, 1, 1,1,1},p[]={0,1,2,3,4,5,6,7,8}計算f[i]時,f[i]=max(f[j]+1) ,(其中,a[i]>a[j],i>j>=0
Time of Update: 2018-12-05
Humble Numbers Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Problem DescriptionA number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12,
Time of Update: 2018-12-05
#include<stdio.h>char jk[101][101];int m,n;int dir[8][2]={{-1,-1},{-1,0},{-1,1}, {0,1},{0,-1},{1,1},{1,-1},{1,0}};void dfs(int x,int y){ int i,xx,yy; jk[x][y]='*'; for(i=0;i<8;i++) { xx=x+dir[i][0]; yy=y+dir[i][1
Time of Update: 2018-12-05
#include<stdio.h>int dir[4][2]= {{-1,0},{1,0},{0,-1},{0,1}};char jk[25];int flag[25][25];int num;void dfs(int x,int y){ int i,j,xx,yy; for(i=0; i<4; i++) for(j=0; j<4; j++) { xx=x+dir[i][0]; yy=y+
Time of Update: 2018-12-05
http://codeforces.com/problemset/problem/268/Ahttp://codeforces.com/problemset/problem/268/Bhttp://codeforces.com/problemset/problem/268/C// cf #164 div2 A #include<stdio.h>int a[30],b[30];int main(){ //freopen("input.txt","r",stdin); //
Time of Update: 2018-12-05
#include<stdio.h>char jk[55][55];int dir[4][2]= {{-1,0},{1,0},{0,-1},{0,1}};int flag[55][55];int m,n;void dfs(int x,int y){ //注意這裡比較蛋疼,m,n剛好和x,y座標是相反的。 規律是所在的點和接下來要搜尋的點必須相接才行。 flag[x][y]=1; if(x!=0&&jk[x-1][y]!='