//atcoder
x^2+(y-sqrt{|x|})^2=2//此函数谁知
神贴
欢迎入团
欢迎入团:聊天?
\def{\cGreen}{#52C41A} \def{\cOrange}{#F39C11} \def{\cYellow}{#FADB14} \def{\cRed}{#E74C3C} \def{\colorOfLine}{#A9A9A9} \def{\colorOfDivide}{#000000} \def{\colorOfName}{#000000} \def{\colorOfBox}{#000000} \def{\colorOfContent}{#000000} \newcommand{\item}[2]{\color{\colorOfName}\textbf{#1:}\text{#2} & } \newcommand{\add}[2]{ \fcolorbox{\colorOfBox}{#2}{\normalsize\vphantom{+}\kern{#1 mm}} } \newcommand{\main}[6]{ \boxed{ \color{white}\begin{cases} &\color{\colorOfLine}\kern{4pt}\begin{vmatrix}\raisebox{90pt}{}\kern{48.56mm}\end{vmatrix}\kern{-5.5pt}\begin{vmatrix}\raisebox{90pt}{}\kern{48.56mm}\end{vmatrix} \\[-108pt] &\color{\colorOfDivide}\scriptsize\kern{4 pt}\text{0}\kern{48.2 mm}\text{50}\kern{47 mm}\text{100} \\[3pt] \item{基础信用}{#1} \add{#1}{\cGreen} \\[3pt] \item{练习情况}{#2} \add{#2}{\cYellow} \\[3pt] \item{社区贡献}{#3} \add{#3}{\cGreen} \\[3pt] \item{比赛情况}{#4} \add{#4}{\cGreen} \\[3pt] \item{获得成就}{#5} \add{#5}{\cYellow} \\[3pt] \color{\colorOfName}\textbf{总咕值:\kern{10pt}#6} \end{cases} } \\ } \main{100}{23}{8}{47}{20}{198}蒟蒻一个qwq
团队搜“青云”
//p7678//啊啊啊sd@青云//werqwer54
//yy、、?//drhkbhkbyki//tr阿尔泰//t色rt顾ert有人
//ÏÂarfgsdrtgkshdfgdghhsdidghfihrh//打算让他屁哦//zwhu hope@青云 hop@青云 //胧月
//A星算法
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <cmath>
#define N 6
using namespace std;
class Node {
public:
int x, y;
int f, g, h;
Node(int a, int b) {
this->x = a;
this->y = b;
}
bool operator < (const Node& a)const {
return this->f > a.f;
}
};
bool visit[N][N];
int path[N][N][2];
int realF[N][N];
int addr[N][N];
int att[8][2]= { {-1,-1}, {-1, 0}, {-1, 1}, {0, -1},
{0, 1}, {1, -1}, {1, 0}, {1, 1} };
priority_queue<Node>que;
void PrintPath(int a, int b);
void AStar(int x0, int y0, int x1, int y1);
bool NodeIsLegal(int x, int y, int x0, int y0);
int Mahuattan(int x, int y, int x1, int y1);
int main() {
int zsjs;
cout<<"障碍数:"<<'\n';
cin>>zsjs;
cout<<"障碍:"<<'\n';
for(int i=1;i<=zsjs;i++){
int xx,yy;
cin>>xx>>yy;
addr[xx][yy]=1;
}
fill(visit[0],visit[0]+N*N,false);
fill(path[0][0], path[0][0] + N * N * 2, -1);
fill(realF[0], realF[0] + N * N, 0);
int x0, y0, x1, y1;
cout << "请输入起点:" << endl;
cin >> x0 >> y0;
cout << "请输入终点:" << endl;
cin >> x1 >> y1;
if (!NodeIsLegal(x0, y0, x0, y0)) {
cout << "输入有误!" << endl;
return 0;
}
AStar(x0, y0, x1, y1);
PrintPath(x1, y1);
return 0;
}
void AStar(int x0, int y0, int x1, int y1) {
Node node(x0, y0);
node.g = 0;
node.h = Mahuattan(x0, y0, x1, y1);
node.f = node.g + node.h;
realF[x0][y0] = node.f;
que.push(node);
while (!que.empty()) {
Node node_top = que.top();
visit[node_top.x][node_top.y] = true;
if (node_top.x == x1 && node_top.y == y1) {
break;
}
que.pop();
for (int i = 0; i < 8; i++) {
Node node_next(node_top.x + att[i][0], node_top.y + att[i][1]);
if (NodeIsLegal(node_next.x, node_next.y, node_top.x, node_top.y)) {
node_next.g = node_top.g + int(10 * (sqrt(pow(att[i][0], 2) + pow(att[i][i], 2))));
node_next.h = Mahuattan(node_next.x, node_next.y, x1, y1);
node_next.f = node_next.g + node_next.h;
if (node_next.f < realF[node_next.x][node_next.y] || !visit[node_next.x][node_next.y]) {
realF[node_next.x][node_next.y] = node_next.f;
path[node_next.x][node_next.y][0] = node_top.x;
path[node_next.x][node_next.y][1] = node_top.y;
que.push(node_next);
}
}
}
}
}
void PrintPath(int x1, int y1) {
if (path[x1][y1][0] == -1 || path[x1][y1][1] == -1) {
cout << "没有可行路径!" << endl;
return;
}
int x = x1, y = y1;
int a, b;
while (x != -1 && y != -1) {
addr[x][y] = 2;
a = path[x][y][0];
b = path[x][y][1];
x = a;
y = b;
}
string s[3] = { "□", "██", "☆" };
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
cout << s[addr[i][j]];
cout << endl;
}
}
bool NodeIsLegal(int x0, int y0, int x1, int y1) {
if (x0<0 || y0<0 || x0>N - 1 || y0>N - 1) return false;
if (addr[x0][y0] == 1) return false;
if (x0 != x1 && y0 != y1 && (addr[x0][y1]==1||addr[x1][y0]==1))return false;
return true;
}
int Mahuattan(int x, int y, int x1, int y1) {
return (abs(x - x1) + abs(y - y1))*10;
}#include<bits/stdc++.h>
using namespace std;
int a,b,k,l[10],r[10];
double ans,sum;
void dfs(int x,int d,int y){
if(y>d)return;
for(int i=x;ans+(double)1/i*d>sum;i++){
cout<<i<<" ";
l[y]=i;
if((double)1/i+ans>sum)continue;
ans+=(double)1/i;
if(ans==sum){
if(k==0||l[y]<r[y]){
for(int j=1;j<=y;j++)r[j]=l[j];
k=y;
}
}
else dfs(i+1,d,y+1);
ans-=(double)1/i;
if(ans>sum)return;
cout<<'\n';
}
}
int main(){
scanf("%d%d",&a,&b);
sum=(double)a/b;
int i=1;
while(1){
dfs(1,i,1);
if(k)break;
i++;
}
for(int i=1;i<=k;i++)printf("%d ",r[i]);
return 0;
}