http://acm.hdu.edu.cn/showproblem.php?pid=2549
//水题 #include <iostream> #include <string> using namespace std; int main() { int t, n; string num; int flag; cin >> t; while (t--) { cin >> num >> n; flag = num.find('.'); if (n > num.length()-flag-1) cout << 0 << endl; else cout << num[flag+n] << endl; } return 0; }