十日十月Freddie

关注

HDU 1163 Eddy's digital Roots

十日十月Freddie

关注

阅读 85

2022-08-04


题目地址:​​点击打开链接​​

思路:9余数定理​

AC代码:

#include <iostream>

using namespace std;

int main()
{
int n,i;
while(cin>>n)
{
if(n == 0)
break;
int temp = 1;
for(i=0; i<n; i++)
{
temp = (temp * n) % 9;
}
if(temp == 0)
cout<<9<<endl;
else
cout<<temp%9<<endl;
}
return 0;
}



相关推荐

大柚子top

hdu 1163 Eddy's digital Roots

大柚子top 70 0 0

佃成成成成

HDU 1163 Eddy's digital Roots(九余数定理)

佃成成成成 70 0 0

南陵王梁枫

HDOJ 1163 Eddy's digital Roots(九余数定理的应用)

南陵王梁枫 66 0 0

爱我中华8898

HDU 1013 Digital Roots

爱我中华8898 62 0 0

夕颜合欢落

hdu 1013 Digital Roots(模拟 || 数论)

夕颜合欢落 54 0 0

ZSACH

HDU 1013 Digital Roots(模拟计算)

ZSACH 57 0 0

互联网码农

Digital Roots

互联网码农 124 0 0

8052cf60ff5c

HDOJ  1013   Digital Roots

8052cf60ff5c 55 0 0

月半小夜曲_

HDU2204 Eddy's爱好

月半小夜曲_ 38 0 0

圣杰

HDU1162 Eddy's picture【Prim】

圣杰 47 0 0

精彩评论(0)

0 0 举报