This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <algorithm> | |
using namespace std; | |
int N; | |
int origin[500001], target[500001]; | |
int main() | |
{ | |
while (scanf("%d",&N)){ | |
if (!N) break; | |
for (int i=0; i<N; i++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <cctype> | |
using namespace std; | |
const char keyboard[] = "`1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./"; | |
int main() | |
{ | |
char c; | |
while (scanf("%c",&c) != EOF){ | |
c = tolower(c); //換成小寫字母 | |
if (isspace(c)) printf("%c",c); //如果為' '或'\n'直接輸出 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
using namespace std; | |
double Abs(double a) { return a<0 ? -a : a; } | |
int main() | |
{ | |
int H,M; | |
while (scanf("%d:%d",&H,&M) != EOF){ | |
if (!H && !M) break; | |
double H_minute = (double(H) + double(M)/60) * 5; // 將時針換成分鐘表示 | |
double M_minute = double(M); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
#include <string> | |
using namespace std; | |
bool cmp(string a, string b) | |
{ | |
return (a+b) > (b+a); | |
} | |
int main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <cmath> | |
using namespace std; | |
int main() | |
{ | |
const double pi = 2 * asin(1); | |
int Case,N, F; | |
int R[10001]; | |
scanf("%d",&Case); | |
while (Case--){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
using namespace std; | |
int main() | |
{ | |
int t,n; | |
int p[30]; | |
int diff[30]; | |
while (scanf("%d%d" ,&t,&n) != EOF){ | |
for (int i=0; i<n; i++) scanf("%d",&p[i]); | |
diff[0] = p[0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
using namespace std; | |
char image[30][30]; | |
void DFS(int &n, int i, int j) | |
{ | |
image[i][j] = '0'; | |
if (i-1 >= 0 && image[i-1][j] == '1') DFS(n, i-1, j); | |
if (i+1 < n && image[i+1][j] == '1') DFS(n, i+1, j); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <queue> | |
using namespace std; | |
char dungeon[32][32][32]; | |
int Distance[32][32][32]; | |
int L, R, C; | |
const int direction[6][3] = {{-1,0,0},{1,0,0},{0,-1,0},{0,1,0},{0,0,-1},{0,0,1}}; | |
struct point_type{ | |
int x; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <algorithm> | |
using namespace std; | |
int main() | |
{ | |
ios::sync_with_stdio(false); | |
int n; | |
string str; | |
cin >> n; | |
while (n--){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
//#include <cstdio> | |
#include <vector> | |
#include <algorithm> | |
using namespace std; | |
string str; | |
int n; | |
void choose_ch (vector<char> &ans,int start) |