| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 394 人关注过本帖
标题:新手头次发帖望大神相助
取消只看楼主 加入收藏
yenga
Rank: 1
等 级:新手上路
帖 子:39
专家分:7
注 册:2013-11-25
结帖率:75%
收藏
已结贴  问题点数:10 回复次数:2 
新手头次发帖望大神相助
问的问题如果有点低级请不要鄙视。。
我是新手。。
嗯下面的程序两个printf都不是我要的答案,第二个还输不出来,哪里错了
求指点谢谢

#include"stdio.h"
#include"stdlib.h"
#include"math.h"

int main()
{
int x,y,a,b,c,d,t;
while(scanf("%d%d",&x,&y)!=EOF)
{
a=pow(x,1)%10;
b=pow(x,2)%10;
c=pow(x,3)%10;
d=pow(x,4)%10;
t=y%4;
printf("%d%d%d%d",a,b,c,d);
switch(t)
 {
 case'1':
 printf("%d",a);
 break;
 case'2':
 printf("%d",b);
 break;
case'3':
 printf("%d",c);
  break;
 case'0':
 printf("%d",d);
  break;
 }
}
return 0;
}
搜索更多相关主题的帖子: include 
2013-11-25 17:04
yenga
Rank: 1
等 级:新手上路
帖 子:39
专家分:7
注 册:2013-11-25
收藏
得分:0 
谢谢,改动后可以运行了,,
但是提交的时候出现了问题,

这是题目的网址
http://acm.hdu.

我修改后的程序这样
#include"stdio.h"
#include"stdlib.h"
#include"math.h"

int main()
{
int x,y,a,b,c,d,t;
while(scanf("%d%d",&x,&y)!=EOF)
{
a=(int)pow(x,1)%10;
b=(int)pow(x,2)%10;
c=(int)pow(x,3)%10;
d=(int)pow(x,4)%10;
t=y%4;

switch(t)
 {
 case 1:
 printf("%d\n",a);
 break;
 case 2:
 printf("%d\n",b);
 break;
case 3:
 printf("%d\n",c);
  break;
 case 0:
 printf("%d\n",d);
  break;
 }
}
return 0;
}

提交不了怎么办。。。
2013-11-25 18:06
yenga
Rank: 1
等 级:新手上路
帖 子:39
专家分:7
注 册:2013-11-25
收藏
得分:0 
回复 6楼 pangshch
Problem Description
lcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius: gave a and b,how to know the a^b.everybody objects to this BT problem,so lcy makes the problem easier than begin.
this puzzle describes that: gave a and b,how to know the a^b's the last digit number.But everybody is too lazy to slove this problem,so they remit to you who is wise.

 

Input
There are mutiple test cases. Each test cases consists of two numbers a and b(0<a,b<=2^30)

 

Output
For each test case, you should output the a^b's last digit number.

 

Sample Input
7 66
8 800
 

Sample Output
9
6
2013-11-25 20:06
快速回复:新手头次发帖望大神相助
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011515 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved