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编译器下运行,待究。。。
- saw(获取随机数)
- 获取随机数
- 获取随机数
- 获取随机数
- 随机数获取
- 获取随机数
- oc获取随机数(主要是c语言的随机数)
- csu1006:SAW
- Java获取随机数(工具类)
- 获取给定区间的随机数(整型)
- 获取随机数(纯数字和混合)
- 获取随机数(max与min之间)
- Python random模块(获取随机数)
- Flash.获取随机数
- JAVA获取随机数
- JAVA获取随机数
- 使用rand获取随机数
- 如何获取随机数
- Android - DrawerLayout的使用
- 我的Cocos2d-x学习笔记(一)Windows下程序如何开始运行
- 读书笔记之Java程序性能优化
- 并发模型
- C/C++中关于struct内存对齐问题
- saw(获取随机数)
- ACM-鸡兔同笼
- hdu1716 排列2(排列生成算法)
- java里面<>的语法
- 当复制LoadRunner脚本内容至记事本中文出现乱码
- 理解 MySQL(1):架构和概念
- 全排列算法 - php 实现
- 算法题:最长公共子序列
- 下拉刷新,UIRefreshControl