10 条题解
-
0
#include<iostream> #include<vector> using namespace std;
int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); vector<int> arr; int value = 0; int num = 0; int sum = 0; while (1) { cin >> value; if (value != 0) { arr.push_back(value); if (value % 2 == 0) { num++; } else { sum += value; } } else { break; } }
cout << "偶数的个数:" << num << endl << "奇数的总值:" << sum << endl; return 0;
}
-
0
#include<bits/stdc++.h> using namespace std; #define endl '\n' #define int long long signed main(){ vector<int>arr1; int n; int sum=0,ans=0; while(cin>>n){ if(n0){ break; } else{ arr1.push_back(n); } } for(auto i:arr1){ if(i%20){ ans++; } else{ sum+=i; } } cout<<ans<<endl<<sum;
return 0;
}
-
0
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; int o_count = 0; int j_count = 0; while(cin >> n){ if(n == 0) break; else{ if(n % 2 == 0) o_count++; else j_count += n; } } cout << o_count << endl << j_count; return 0; }
- 1
信息
- ID
- 8
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 5
- 标签
- 递交数
- 1477
- 已通过
- 574
- 上传者