[英]Can't understand the requirement from the exercise
this https://projecteuler.net/problem=641 is the problem I am trying to solve and below is my half solution.这个https://projecteuler.net/problem=641是我要解决的问题,下面是我的一半解决方案。
void dice(int n)
{
int i, j, dices[n];
for(i = 0; i < n; i++) {
dices[i] = 1;
}
for(i = 1; i < n; i++)
{
for(j = 0; j < n; j+=i)
{
dices[j]= dices[j] > 5?1:dices[j]+1;
}
};
for(i = 0; i < n; i++) {
cout << i+1 << "th dice is :" << dices[i] << endl;
}
};
this is the part I do not get: Let f(n) be the number of dice that are showing a 1 when the process finishes .这是我没有得到的部分:设 f(n) 为进程完成时显示为 1 的骰子数。 You are given f(100)=2 and f(10^8)=69.你得到 f(100)=2 和 f(10^8)=69。 Find f(10^36).求 f(10^36)。
from "f(100)=2" I understand that the 100th die should be 2 but f(10^8)=69 loses me.从 "f(100)=2" 我知道第 100 个骰子应该是 2 但 f(10^8)=69 失去了我。
Read the problem description again.再次阅读问题描述。 There is a definition of f() there:那里有一个f()的定义:
Let f(n) be the number of dice that are showing a 1 when the process finishes.设f(n)为过程结束时显示为 1的骰子数。
If is not a value of any specific die.如果不是任何特定骰子的值。 Instead, the value of f(n) tells you how many dice in the n –dice row show 1 after completion of all turns.取而代之的是, f(n)的值告诉您在完成所有回合后, n –dice 行中有多少个骰子显示为 1。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.