hanxin
来源:互联网 发布:js let 编辑:程序博客网 时间:2024/04/29 14:56
#include <iostream>
#include<stdio.h>
using namespace std;
void hanxin(int a,int b,int c)
{
int temp,i;
for(i=1;i<14;i++)
for(int j=2;j<20;j++)
{
temp=c+7*i;
if((5*j+b)==temp)
{
for(int k=3;k<33;k++)
if((3*k+a)==temp)
{
printf("%d\n",temp);return; //此处用break会出现即使有结果如2 1 6也输出41 No answer
}
}
}
if(i==14)
printf("No answer\n");
}
int main()
{
int a,b,c;
while(scanf("%d%d%d",&a,&b,&c)!=EOF){
hanxin(a,b,c);
}
return 0;
}
#include<stdio.h>
using namespace std;
void hanxin(int a,int b,int c)
{
int temp,i;
for(i=1;i<14;i++)
for(int j=2;j<20;j++)
{
temp=c+7*i;
if((5*j+b)==temp)
{
for(int k=3;k<33;k++)
if((3*k+a)==temp)
{
printf("%d\n",temp);return; //此处用break会出现即使有结果如2 1 6也输出41 No answer
}
}
}
if(i==14)
printf("No answer\n");
}
int main()
{
int a,b,c;
while(scanf("%d%d%d",&a,&b,&c)!=EOF){
hanxin(a,b,c);
}
return 0;
}
1 0
- hanxin
- 韩信点兵(hanxin)
- 韩信点兵(hanxin)
- 2-2 hanxin
- 习题2-2 韩信点兵(hanxin)
- 习题2-2 韩信点兵(hanxin)
- 《算法竞赛入门经典》习题2-3 韩信点兵(hanxin)
- 算法竞赛入门经典 习题2-3 韩信点兵(hanxin)
- JavaWeb学习总结(五十)——文件上传和下载
- OpenGL 实用教程
- Android工程目录结构及基本常用框架
- json字符串转 Dictionary
- tomcat编码设置
- hanxin
- SparkR:数据科学家的新利器
- Latex使用常见问题
- The flow of the app to create the Surface
- 程序猿必备技能之解决github访问慢方案
- android从零单排之设置圆边按钮
- JavaWeb学习总结(一)——JavaWeb开发入门
- 《我的故事》游戏过关技巧
- JavaWeb学习总结(二)——Tomcat服务器学习和使用(一)