saw(获取随机数)

来源:互联网 发布:实惠猪软件下载 编辑:程序博客网 时间:2024/05/21 06:29


Description

I want to play a game.

Up until now, you've simply sat in front of computers watching others cheer to solve their problems. Now I see you as a strange mix of someone apathetic. But mostly just pathetic. ‘Cause you haven’t solved all these problems, at least not this one. So are you going to watch yourself end your warm-up contest here today, or do something about it?

These are the rules. I have nothing in the input data. But you, you come up with a capital letter in your mind. Yes, that’s the very letter I want you to output.

Input

Nothing to input. But congratulations. You still have time.

Most people are so ungrateful to get ACs. But not you. Not anymore.

Output

Know that I'm not lying. Better hurry up. Output the capital letter in your mind.

Make your choice.

Sample Input

(nothing)

Sample Output

(a letter stated above)

HINT

这题wa了无数次,经大神指导终于明白了题目的意思,根据系统时间产生一随机数,并转化为字母,其中涉及到srand函数和rand函数;

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
main()
{
 srand( unsigned( time(0) ));
 int i=rand()%26;
 char a='a';
 a=a+i-32;
 printf("%c",a);
}

大神的指导:

zhuyi13:
用srand()获得随机数种子然后int i=rand(time(NULL))%26;//获得一个0~25的随机数char a='a';a=a+i;cout<<a<<endl;因为time(NULL)获得的随机种子是根据系统时间来得到的所以和后台获得的随机数回一样
还有一点这个程序不能再c编译器下运行,待究。。。
0 0
原创粉丝点击