Lv.1
OLEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
签名:向CSPS冲刺
在 游戏,用emoji描述你的圈子 中回复
imgsrc="https://static.codemao.cn/emoji/codemao/%E7%BC%96%E7%A8%8B%E7%8C%AB_%E5%86%B7%E6%BC%A0.gif"alt="emotion_编程猫_冷漠"
2024-07-24T14:06:13 点赞:0
在 找师傅了~~~ 中回复
#include<bits/stdc++.h>
using namespace std;
int s[20]; bool f[20];
int hun(int x,int y,int z){
return x*100+y*10+z;
}
void dfs(int x){
if(x>9){
int a=hun(s[1],s[2],s[3]);
int b=hun(s[4],s[5],s[6]);
int c=hun(s[7],s[8],s[9]);
if(b%2==0&&c%3==0&&b/2==c/3&&b/2==a)
printf("%d %d %d\n",a,b,c);
return ;
}
for(int i=1; i<=9; i++)
if(f[i]==0){
f[i]=1;
s[x]=i;
dfs(x+1);
f[i]=0;
}
}
int main(){
dfs(1);
return 0;
}2024-07-24T14:11:20 点赞:0
在 一句话证明你的年级 中回复
#include<bits/stdc++.h>
using namespace std;
int main(){
printf("我在学校学C++");
return 0;
}2024-07-25T12:19:21 点赞:1
在 递归怎么做?我不会 中回复
返回类型 函数名(参数){
if(返回条件) return 答案;
进行操作(包含“函数名(下一层参数)”)
return 答案;
}
样例:
int dfs(int x){
if(x==0) return 1;
return dfs(x-1)+x;
}
2024-07-25T12:24:00 点赞:0