Skip to content

Instantly share code, notes, and snippets.

#include <bits/stdc++.h>
using namespace std;
map<string, int> Map; //將每個點從字串換成編號
vector<string> toPoint[10001]; // 用來存每個點能連到哪些點
void BFS(string Start, string End)
{
queue<string> Q;
Q.push(Start);
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;
int BFS(int Start, int End, vector<int> toPoint[])
{
int visit[21] = {0};
queue<int> Q;
Q.push(Start);
#include <cstdio>
#include <vector>
using namespace std;
int DFS (int node, vector<int> toNode[30], int dis, bool visit[][30])
{
int longest_length = 0; // 當前node能走的最遠距離
for (int nxt_node : toNode[node]){
if (!visit[node][nxt_node]) { // 該條線還沒走過
visit[node][nxt_node] = 1;
visit[nxt_node][node] = 1; // 雙向關閉
#include <cstdio>
#include <queue>
using namespace std;
struct point_type{
int i;
int j;
};
const int direction[][2] = {{-2,-1},{-1,-2},{1,-2},{2,-1},{2,1},{1,2},{-1,2},{-2,1}};
int BFS(point_type Start, point_type End)
{
#include <cstdio>
#include <vector>
#include <string>
using namespace std;
int A, B, N;
vector<string> process;
int visit[1005][1005];
bool DFS(int a, int b)
{
#include <cstdio>
#include <queue>
#include <map>
#include <vector>
using namespace std;
map<int, int> mapping;
struct node_type{
vector<int> connceted_node;
};
int NC;
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <queue>
#include <cstdio>
using namespace std;
struct route_type{
vector<string> route;
};
#include <cstdio>
using namespace std;
int N;
char board[201][201];
const int direction[][2] = {{-1,-1},{-1,0},{0,-1},{0,1},{1,0},{1,1}};
void DFS(int i, int j, char c,int &win)
{
board[i][j] = '.';
if (c == 'b' && i == N-1) win = 1;
if (c == 'w' && j == N-1) win = 2;
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
double n,p;
while (scanf("%lf %lf", &n, &p) != EOF)
printf("%.0f\n",pow(p,1.0/n));
return 0;
}
#include <cstdio>
#include <iostream>
using namespace std;
int main()
{
long long a,b;
while (scanf("%lld%lld",&a,&b)){
if (!a && !b) break;
if (a > b) swap(a,b); // a:寬 b:長
long long ans = a*b*(a-1) + a*b*(b-1); //寬 + 長