Login
Register
Problem list
Online status
Huhu_Miao
:
2024-11-20 17:17:33
/** * author: Huhu_Miao * created: 2024.11.20 17:16:00 (UTC+8) **/ #include
void solve(){ std::string str; std::getline(std::cin , str); int cnt = 0; for(const auto elem : str){ if(std::isdigit(elem)) cnt++; } std::cout << cnt << '\n'; } int main(){ std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int T; std::cin>>T; std::cin.ignore(10 , '\n'); while(T--) solve(); return 0; }
lycoris
:
2024-03-08 16:23:52
#include
using namespace std; int main() { int n, a, b; cin >> n; cin.ignore(); for (int i = 0; i < n; i++) { int count = 0; char c[110]; cin.getline(c, 110); // Specify the maximum number of characters to read for (int j = 0; j < strlen(c); j++) { if (c[j] >= '0' && c[j] <= '9') { count++; } } cout << count << endl; } }
214793
:
2021-10-22 16:48:32
#include
#include
#include
using namespace std; int main() { int n; int a[100] = {}; cin >> n; cin.ignore(); for (int i = 0; i < n; i++) { int count = 0; char s[100]; cin.getline(s, 100, '\n'); for (int i = 0; i < strlen(s); i++) { if (s[i] <= '9' && s[i] >= '0') count++; } a[i] = count; } for (int i = 0; i < n; i++) cout << a[i] << endl; }
1
:
2020-07-19 16:06:43
#include
int main() { int n; char c[110]; scanf("%d", &n); fgets(c, 110, stdin); for(int i=0; i
Post Your Comment