fork download
  1. // بسم الله الرحمن الرحيم
  2.  
  3. #include <bits/stdc++.h>
  4. using namespace std;
  5.  
  6. template<typename T> ostream& operator<<(ostream& os, vector<T>& v) { for (auto& i : v) os << i << ' '; return os; }
  7. template<typename T> istream& operator>>(istream& is, vector<T>& v) { for (auto& i : v) is >> i; return is; }
  8.  
  9. #define FreePalestine ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
  10.  
  11. #define endl '\n'
  12. #define int long long
  13. #define ull unsigned long long
  14. #define vi vector<int>
  15. #define vvi vector<vi>
  16. #define pi pair<int, int>
  17. #define all(a) a.begin(), a.end()
  18. #define all_r(a) a.rbegin(), a.rend()
  19.  
  20. const int N = 2e5, oo = 2e18, MOD = 1e9+7;
  21.  
  22. void solve() {
  23. int x; cin >> x;
  24.  
  25. int ans = 9;
  26. while (x) {
  27. ans = min(ans, x % 10);
  28. x /= 10;
  29. }
  30. cout << ans << endl;
  31. }
  32.  
  33.  
  34. signed main() {
  35. FreePalestine;
  36. // #ifndef ONLINE_JUDGE
  37. // freopen("input.txt", "r", stdin);
  38. // freopen("output.txt", "w", stdout);
  39. // #endif
  40. int t; t = 1;
  41. cin >> t;
  42. while (t--) solve();
  43. return 0;
  44. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
9