#include<bits/stdc++.h> #define int long long using namespace std; const int N = 1e5+10; const int M = 1e9+7; //下面这个函数为有效代码 void solve() { int n; cin>>n; string s; for(int i=1;i<=1000;i++) { string s1; int h =i; //把数字转换为字符串 while(h) { s1 += (h%10+'0'); h/=10; } //把数字反转,上面求的s1为数字从低位到高位,比如10,经过上面转换得到的s1 = 01 //下面这个函数把s1反转, reverse(s1.begin(),s1.end()); s += s1; if(s.size()>n) break; } //因为s是从0开始的,所以输出n-1,也可在前面写 s = " " + s;这样可以直接输出s[n] cout<<s[n-1]; } signed main() { ios::sync_with_stdio(0); cin.tie(0),cout.tie(0); int _ = 1; //cin >> _ ; while(_--) solve(); return 0; }