【CCF计算机资格认证】201912-1报数C++
作者:互联网
#include "iostream"
using namespace std;
int main()
{
int num, n;
cin >> n;
int index = 0, i;
int people[4] = {0};
for (i = 1; i <= n; i++)
{
num = i;
if (num % 7 == 0)
{
people[index] += 1;
n++;
}
else
{
while (num != 0)
{
if (num % 10 == 7)
{
people[index] += 1;
n++;
break;
}
num = num / 10;
}
}
index = index == 3 ? 0 : index + 1;
}
for (int c : people)
{
cout << c << endl;
}
}
Memory逆光
发布了75 篇原创文章 · 获赞 128 · 访问量 1万+
私信
关注
标签:私信,people,int,201912,C++,num,Memory,文章,CCF 来源: https://blog.csdn.net/weixin_44936889/article/details/104079388