1 Star 0 Fork 0

Ash_Miku/ACM

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
【函数的指针参数】求解鸡兔问题 457 Bytes
一键复制 编辑 原始数据 按行查看 历史
#include <stdio.h>
#include <stdio.h>
int calc(int,int,int*,int*);
int main()
{
int h,f;
while(scanf("%d%d",&h,&f)!=EOF){
int c,r;
if(calc(h,f,&c,&r))
printf("%d %d\n",c,r);
else
printf("no solution\n");
}
return 0;
}
int calc(int a,int b,int*c,int*r)
{
*c=(4*a-b)/2;
*r=(b-2*a)/2;
if(b<(2*a)||(4*a)<b||b%2!=0)
{
return 0;
}
else
{
return 1;
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ash_miku/ACM.git
[email protected]:ash_miku/ACM.git
ash_miku
ACM
ACM
master

搜索帮助