Time of Update: 2018-12-03
#include<stdio.h>#include<stdlib.h>struct node{int x;int y;}p[5100];int da[5100];int cmp(const void *z,const void *y){struct node * as=(struct node *)z;struct node * ad=(struct node *)y;if(as->x!=ad->x)return
Time of Update: 2018-12-03
/*有向歐拉通路問題,把單詞首尾字母當做點,單詞是他們之間的關係1.此圖連通2.有且僅有兩個點出度和入度不同,但差是1;其餘點的出度和入度相等*/#include<stdio.h>#include<string.h>#include<math.h>int r[30],c[30],ji[30];char word[1000];int root(int a){while(a!=ji[a])a=ji[a];return a;}int main(){int
Time of Update: 2018-12-03
/*輸入最大數是2的32次方,故所有輸出<=32,故可以枚舉沒想到pow(1.0*n,1.0/i)還能這樣開n的i次方*/#include<stdio.h>#include<math.h>int main(){__int64 b,bb;int i,j;while(scanf("%I64d",&b),b){double z,zz;int x,y;if(b==1){printf("1\n");continue;}if(b>0){for(i=32;i>
Time of Update: 2018-12-03
#include<stdio.h>#include<string.h>#include<queue>using namespace std;int map[201][210];int n,m;int f[210];int pre[210];int bfs()//廣搜找增廣路徑{queue<int>q;int
Time of Update: 2018-12-03
/*先求各點到1的最短路然後從個最短路中找到最大值原型:int atoi(const char *nptr); 函數說明:參數nptr字串,如果第一個非空白字元不存在或者不是數字也不是加號或減號則返回0,否則開始做類型轉換,之後檢測到非數字(包括結束符 \0) 字元時停止轉換,返回整型數。*/#include<stdio.h>#include<stdlib.h>#include<string.h>int
Time of Update: 2018-12-03
/*本題就是從Y走到T用對長時間,E可直接過,B打一炮才能過(打炮和走格都用時為1),R、S過不去用到優先隊列*/#include<stdio.h>#include<queue>using namespace std;char map[310][310];int vis[310][310];int m,n;int sx,sy,ex,ey;int dir[4][2]={-1,0, 0,-1, 1,0, 0,1};struct node{friend bool
Time of Update: 2018-12-03
#include<stdio.h>int t[1000010],p[10100],next[10100];int n,m;void getnext(){ int i,j; next[1]=0; i=1; j=0; while(i<=m) { if(j==0||p[i]==p[j]) { i++; j++; if(p[i]!=p[j]) next[i]
Time of Update: 2018-12-03
/*Floyd演算法+點權值+記錄路徑*/#include<stdio.h>int map[110][110],tax[110],path[110][110];int n;#define imax 999999999void floyd(){int i,j,k,t;for(i=1;i<=n;i++)for(j=1;j<=n;j++)path[i][j]=j;//path[i][j]存從i到j的路徑中除始末站外的第一站for(k=1;k<=n;k++)for(i=1;
Time of Update: 2018-12-03
/*這題沒啥難度,但是做的很鬱悶之前的題說以“##”為結束標誌,該行無效;一般沒有以“##”開始的有效行,所以一直用s[0]=='#'&&s[1]=='#'為判斷標誌今兒載他手裡了,還就有以“##”開始的資料行以後規範點兒吧*/#include<stdio.h>#include<string.h>char s[110][20000];int main(){int
Time of Update: 2018-12-03
/*線段樹題這題很簡單,但是老是Runtime Error(ACCESS_VIOLATION)一直找不到,就看著一老兄的,改My Code一直把他的函數都搬過來了,還是那樣就又把輸入部分抄了過來,這才對了原來是處理'\n'的時候出的錯但是在我的機器上一切正常其實可以無視'\n'或用" %s"空白字元處理*/#include<stdio.h>#include<string.h>struct node{int l,r,zhi;}e[200000];int num=1,SUM;
Time of Update: 2018-12-03
/*千萬要注意輸出“Yes”和“No”的時候是首字母大寫還是全大寫注意變數初始化*/#include<stdio.h>#include<string.h>double map[35][35],hui;char s[35][150],nam[150],nam1[150];int n,m,f,num=1,nnum;#define Max(a,b) (a)>(b)?(a):(b)void floyd(){int i,j,k;for(k=1;k<=n;k++)for(
Time of Update: 2018-12-03
Description請看下面兩段文字: Kenny喊道:"我來了!" Kenny喊道:“我來了!” 前面一段文字中由於在中文中使用了英文標點,顯得不太美觀。本題中你的任務是讓任意一段文字美觀化。美觀化具體要求為將以下字元(串)轉換為對應的中文字元: 英文 中文 , , . 。 ! ! " “或” << 《 >> 》 ? ?Input
Time of Update: 2018-12-03
#include<stdio.h>#include<string.h>#include<stdlib.h>char a[20];int len;int cmp(const void *a,const void *b)//排序用{int c,d;char e=*(char *)a,f=*(char *)b;if(e<'a')c=e*2+63;else c=e*2;if(f<'a')d=f*2+63;else d=f*2;return
Time of Update: 2018-12-03
#include<stdio.h>#include<string.h>char codes[][15]={"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen","eighteen",
Time of Update: 2018-12-03
#include<stdio.h>typedef __int64 lint;lint jie[]={1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000,10000000000};lint count(lint n){int i;lint
Time of Update: 2018-12-03
/*很簡單一題,但是因為英語不好,沒過(老是逾時)*/#include<stdio.h>#include<string.h>struct node{char s1[100],s2[100];}q[11];char s[300];void cao(char *p,int i)//原先用string.h中的函數,老逾時,就自己操作了,還是逾時,就沒改回去{int
Time of Update: 2018-12-03
#include<stdio.h>#include<string.h>#include<stdlib.h>char s[110];int cmp(int m){ int l=strlen(s),n; if(l>6) return 0; n=atoi(s); if(n>m) return 0; return 1;}int main(){ int t,n,m; scanf("%d",
Time of Update: 2018-12-03
#include<iostream>#include<stdio.h>#include<map>//#include<cstdio>//#include<cstring>#include<string>using namespace std;int sc;int main(){ int n, i, j, m, mi, r; char name[35]; string s; cin>>n;
Time of Update: 2018-12-03
/*poj1975 Median Weight Bead題意:有N個珠子,N為奇數(an odd number),給出一些資訊如a b表示a比b重,通過這些資訊可以分析出那些珠子按重量排序後,哪個不可能是中間那個,求可以分析出幾個。用到的是floyd求傳遞閉包,然後找到那些入度或出度大於n/2的珠子即可*/#include<stdio.h>#include<string.h>int g[100][100];//g[i][j]表示j比i輕void floyd(int n){
Time of Update: 2018-12-03
#include<stdio.h>#include<vector>#include<string.h>using namespace std;struct node{int x,y,z;}w[510];vector<int>h[510];int match[510];int vis[510];int dfs(int i){for(int j=0;j<h[i].size();j++){if(!vis[h[i][j]])//之前誤寫成vis[j]