当前位置:网站首页>@5-1 CCF 2019-12-1 报数
@5-1 CCF 2019-12-1 报数
2022-07-25 09:19:00 【叶萧白】
题目描述

样例

源代码
#include <iostream>
#include <algorithm>
using namespace std;
int judge(int n)
{
if (n % 7 == 0)
{
return 1;
}
while (n)
{
if (n % 10 == 7)
{
return 1;
}
n /= 10;
}
return 0;
}
int main()
{
int n;
cin >> n;
int a[4] = {
0 };
for (int i = 1; i <= n; i++)
{
if (judge(i))
{
n++;
a[(i-1)%4]++;
}
}
for (int i = 0; i < 4; i++)
{
cout << a[i] << endl;
}
return 0;
}
关于这题
用judge判断数是否符合要求
判断这个数 如果要被跳过 那么 就n++
求甲乙丙丁 其实就可以向4取余
边栏推荐
猜你喜欢

Programmers can't SQL? Ashes Engineer: all waiting to be eliminated! This is a must skill!

使用nexus3发布yum私服(离线-内网)

Ranking of data results in MySQL

Activemq-- delayed delivery and scheduled delivery

What are stand-alone, cluster and distributed?

API健康状态自检

yarn : 无法加载文件 yarn.ps1,因为在此系统上禁止运行脚本。

How can technologists start their personal brand? Exclusive teaching of top five KOLs

PHP网站设计思路

粗柳簸箕细柳斗,谁嫌爬虫男人丑 之 异步协程半秒扒光一本小说
随机推荐
『怎么用』代理模式
[SCADA case] myscada helps VIB company realize the modernization and upgrading of production line
ActiveMQ -- leveldb of persistence mechanism
Numpy- array属性、改变形状函数、基本运算
MySQL appends a string to the string of a field in the table [easy to understand]
【线程知识点】-- 自旋锁
SSM高级整合
分布式一致性协议之Raft
数据预处理
yarn : 无法加载文件 yarn.ps1,因为在此系统上禁止运行脚本。
Notes on in-depth analysis of C language 2
activemq--可持久化机制之JDBC
C#语言和SQL Server数据库技术
Mongodb installation and use
DVWA练习一 暴力破解
ActiveMQ -- JDBC Journal of persistent mechanism
Go基础4
OverTheWire-Bandit
excl批量导入数据,后台公共解析方法
PHP网站设计思路