to_string()的应用
作用是将数字转化为字符串
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<cstdlib>
#include<set>
#include<ctime>
#include<vector>
#include<cstdio>
#include<list>
using namespace std;
typedef long long ll;
int INF=;
int inf=-;
#define read(x) scanf("%d",&x);
#define fo(i,n) for(int i=1;i<=(n);i++)
#define me(a) memset(a,0,sizeof(a));
#define one(x) cout<<(x)<<endl;
#define two(a,b) cout<<(a)<<" "<<(b)<<endl;
int main()
{
int n;
string s;
for(int i=;i<=;i++)
{
s+=to_string(i);
}
cin>>n;
one(s[n-]);
return ;
}
to_string()的应用的更多相关文章
- C++中的to_string()函数[C++11支持]
C++ -> 字符串库 -> std::basic_string 定义于头文件 std::string to_string(int value); (1) (C++11起) std::st ...
- c++中几种常见的类型转换。int与string的转换,float与string的转换以及string和long类型之间的相互转换。to_string函数的实现和应用。
1.string转换为int a.采用标准库中atoi函数,对于float和龙类型也都有相应的标准库函数,比如浮点型atof(),long型atol(). 他的主要功能是将一个字符串转化为一个数字,在 ...
- caffe中在某一层获得迭代次数的方法以及caffe编译时报错 error: 'to_string' is not a member of 'std'解决方法
https://stackoverflow.com/questions/38369565/how-to-get-learning-rate-or-iteration-times-when-define ...
- c++之to_string()函数
函数原型:string to_string (int val);string to_string (long val);string to_string (long long val);string ...
- C++11中的to_string
C++11之前,标准库没有提供数字类型转字符串的函数,需要借助sprintf.stringstream等,现在C++11提供了std::to_string函数,可以直接使用了: 点击(此处)折叠或打开 ...
- HDU 1013 Digital Roots(to_string的具体运用)
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1013 Digital Roots Time Limit: 2000/1000 MS (Java/Othe ...
- LeetCode - 412. Fizz Buzz - ( C++ ) - 解题报告 - to_string
1.题目大意 Write a program that outputs the string representation of numbers from 1 to n. But for multip ...
- 程设刷题 | 编译C++文件出现to_string is not a member of std 或者 to_string was not declared in this scope的解决方法
写在前面 原文链接:Enabling string conversion functions in MinGW C++在将整型.浮点型.长整型等数据类型转换为字符串时,可使用<string> ...
- error: ‘to_string’ was not declared in this scope
错误: error: ‘to_string’ was not declared in this scope 原因: to_string是C++11引入的新功能,旧版本编译器可能不支持它,所以要给编译器 ...
随机推荐
- PHP解决抢购、秒杀、抢楼、抽奖等阻塞式高并发库存防控超量的思路方法
如今在电商行业里,秒杀抢购活动已经是商家常用促销手段.但是库存数量有限,而同时下单人数超过了库存量,就会导致商品超卖甚至库存变负数的问题. 又比如:抢购火车票.论坛抢楼.抽奖乃至爆红微博评论等也会引发 ...
- CentOS Linux解决Device eth0 does not seem to be present
在VMware里克隆出来的Centos Linux.. ifconfig...没有看到eth0..然后重启网卡又报下面错误. 故障现象: 解决办法: 首先,打开/etc/udev/rules.d/70 ...
- FTP Service mode : PORT & PASV
PORT Mode: 1. FTP client use TCP port 1026 for command to FTP server command port 212. FTP server us ...
- JSP内置对象之application对象
虽然常把Web应用称为B/S架构的应用,但其实Web应用一样是C/S结构的应用,只是这种应用的服务器是Web服务器,而客户端是浏览器. 现在抛开Web应用直接看Web服务器和浏览器. Web服务器负责 ...
- HTML5 data-* 属性
HTML5 data-* 属性 jQuery Mobile 依赖 HTML5 data-* 属性来支持各种 UI 元素.过渡和页面结构.不支持它们的浏览器将以静默方式弃用它们.表 2 显示如何使用 d ...
- UVALive 3644 X-Plosives
X-Plosives Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu [Submit] ...
- PHP计算一年有多少周,每周开始日期和结束日期
一年有多个周,每周的开始日期和结束日期 参考代码一:[正在使用的版本] <?php header("Content-type:text/html;charset=utf-8" ...
- Node.js入门学习笔记(一)
先来个最常见的"Hello World!". 打开你最喜欢的编辑器(我用的是Sublime Text),创建一个helloWorld.js的文件.我们要做的就是向stdout输出& ...
- poj 1655
这道题我有很多要说 首先是基础的解题思路: 树形dp(dfs)用dp[i]保存以i为根结点的子树的大小(含i) balance(i)=max{n-dp[i],max{dp[j]}(j is a son ...
- Linux Swap分区设定
因为准备在linux上面安装Oracle数据库,据说swap分区小于4G容易失败,天啦噜的我连swap分区是啥都不是非常清楚, 大概有个印象吧,但先搞大了再说. 测试证明Ubuntu14默认的swap ...