永发信息网

C语言简单题 Rightmost Digit

答案:1  悬赏:60  手机版
解决时间 2021-04-29 20:49

描述

Given a positive integer N, you should output the most right digit of N^N.

输入

The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow.
Each test case contains a single positive integer N(1<=N<=1,000,000,000).

输出

For each test case, you should output the rightmost digit of N^N.

样例输入

2 3 4

样例输出

7 6

提示

In the first case, 3 * 3 * 3 = 27, so the rightmost digit is 7.
In the second case, 4 * 4 * 4 * 4 = 256, so the rightmost digit is 6     我的代码是 #include<stdio.h>
void main()
{long int x;
int n,i,d;
 scanf("%d",&n);
 for(i=0;i<n;i++)
 { scanf("%ld",&x);
      d=x%10;
   if(d==0||d==1||d==9) printf("%d\n",d);
   else if(d==2) printf("4\n");
   else if(d==3) printf("7\n");
   else if(d==4||d==6||d==8) printf("6\n");
   else printf("3\n");}
}
现在是WA,应该怎么修改啊?
最佳答案

“现在是WA,应该怎么修改啊? ”


WA是什么?

我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
dnf什么材料能卖400金币
新农开发这只股啥时候能开啊!
其通电力工程有限公司这个地址在什么地方,我
不知点做好吖??我钟意左一个不该钟意噶人..点
吃螃蟹喝白酒可以吗,白酒可以冰冻了喝吗?
欧陆和法拉利458哪个好
He appeared to be talking to himself.
为什么KU6视频看不了了?
我梦见我和我爱的她在网吧见面又不知怎么就分
问,熊猫最大的愿望是什么
怎样给头发补充营养?
我的u盘打不开
类似CS的游戏
为什么总是生病呀?经常的感冒
阿朱和乔峰的爱情句子,哪首歌歌词有眼泪被时
推荐资讯
430克等于多少千克?用最简分数表示
光驱无法读取系统盘
怎样写小学毕业诗歌,三毛最打动你的一首诗是
生姜能生发吗,生姜真有生发的作用吗?
如何换算手机尺寸?
好想要满屋子的熊和兔子,怎么办
蔬果多超市这个地址在什么地方,我要处理点事
pes6最新转会名单,新人名单,球员位置名单
求施工组织设计
东方副食商城怎么去啊,有知道地址的么
企业信息系统开发策略与战略目标怎样实现统一
中了New Poly Win32怎么搞啊? 认识我家的到
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?