一个数的个位为偶数时这个数就是偶数,两个数都为奇数时积才是奇数,'0' 的 ASCLL 码为 。
#include <bits/stdc++.h>
using namespace std ;
long long n , cnt ;
string a[1005] ;
int main() {
cin >> n ;
for(int i = 1 ; i <= n ; i ++) {
cin >> a[i] ;
}
for(int i = 2 ; i <= n ; i ++) {
cnt += (a[i][a[i].size() - 1] % 2 && a[i - 1][a[i - 1].size() - 1] % 2) ;
}
cout << cnt ;
return 0 ;
}
- 时间复杂度: 。
- 空间复杂度: 。
暂无评论