CSU 1101: 报数游戏(水题)
来源:互联网 发布:淘宝虚拟现实vr购物 编辑:程序博客网 时间:2024/06/05 07:03
1101: 报数游戏
Time Limit: 1 Sec Memory Limit: 128 Mb Submitted: 1135 Solved: 364Description
Input
Output
Sample Input
4 3 14 3 24 3 34 3 40 0 0
Sample Output
17212735
Hint
Source
湖南省第七届大学生计算机程序设计竞赛
想法:
水题
代码:
#include<stdio.h>
#include<string.h>
int judg(int n)
{
if(n%7==0)
{
return 1;
}
int t;
while(n>0)
{
t=n%10;
n=n/10;
if(t==7)
return 1;
}
return 0;
}
int main()
{
int n,m,k;
while(scanf("%d%d%d",&n,&m,&k)&&n+m+k)
{
int i,j;
int t=m;
int count=0;
if(judg(m)&&k==1)
{
printf("%d",m);
continue;
}
if(judg(m))
{
count++;
}
if(m!=1&&m!=n)
{
for(i=1;i<=100000;i++)
{
if(i%2!=0)
{
t=t+(n-m)*2;
//printf("%d\n",t);
if(judg(t))
{
count++;
}
}
else
{
t=t+(m-1)*2;
//printf("%d\n",t);
if(judg(t))
{
count++;
}
}
if(count==k)
{
printf("%d\n",t);
break;
}
}
}
else
{
for(i=1;i<10010;i++)
{
t=t+(n-1)*2;
if(judg(t))
{
count++;
}
if(count==k)
{
printf("%d\n",t);
break;
}
}
}
}
return 0;
}
- CSU 1101: 报数游戏(水题)
- csu-1101: 报数游戏
- CSU 1101 报数游戏
- csu----报数游戏
- 报数游戏(二)
- 约瑟夫环(报数游戏)
- 报数游戏
- 报数游戏
- 报数游戏
- 报数游戏
- 报数游戏
- 报数游戏
- 报数游戏
- 报数游戏
- 报数游戏
- 报数游戏
- 报数游戏
- 报数游戏
- 使用embedded jetty作为mock server
- 51nod 1836 战忽局的手段 矩阵乘法
- js正则表达式
- 字符编码 ASCII,Unicode和UTF-8的关系
- 记录我的caffe2 vs2017安装过程
- CSU 1101: 报数游戏(水题)
- 【Spring】Spring MVC原理及配置详解
- 区块链解读2
- 2257: [Jsoi2009]瓶子和燃料
- 1754:字符串数组排序问题(4.1算法之排序和算法性能)
- Shiro授权详细解析
- Android打造流畅九宫格抽奖
- MapReduce运行模式-本地模式配置
- 将大数据写入数据库