Primary Olympics question:
On the blackboard, the name is like 8888 ...... The number of 88 is erased from the last digit. Multiply the previous digit by 2, and then add the erased digit to continue the operation on the new number. What is the final result?
Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;
Namespace consoleapplication1
{
/// <Summary>
/// On the blackboard, the name is shown as 8888 ...... The number of 88 is erased from the last digit. Multiply the previous digit by 2, and then add the erased digit to continue the operation on the new number. What is the final result?
/// Master code♂Luo Yun
/// </Summary>
Class Program
{
Static void main (string [] ARGs)
{
Int64 tem2 = 0;
Int64 TEM = 88888888;
While (TEM> 10)
{
Tem2 = (int64) (TEM/10) * 2 + (TEM % 10 );
TEM = tem2;
}
Console. Write (TEM. tostring ());
// Output 8
Console. Read ();
}
}
}
Primary Olympics question:
On the blackboard, the name is like 8888 ...... The number of 88, each time a last digit is erased, the previous number is multiplied by 2, and then the last digit is erased, the new number is continued, what is the final number?
Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;
Namespace consoleapplication1
{
/// <Summary>
/// On the blackboard, the name is shown as 8888 ...... The number of 88, each time a last digit is erased, the previous number is multiplied by 2, and then the last digit is erased, the new number is continued, what is the final number?
/// Write by Master♂Luo Yun
/// </Summary>
Class Program
{
Static void main (string [] ARGs)
{
Int64 tem2 = 0;
Int64 TEM = 88888888;
While (TEM> 10)
{
Tem2 = (int64) (TEM/10) * 2 + (TEM/10 );
// Tem2 = (int64) TEM/10*2 + (TEM-TEM/10*10)
TEM = tem2;
}
Console. Write (TEM. tostring ());
// Output 3
Console. Read ();
}
}
}