G - Lucky 7 in the Pocket(签到题)
思路:
大于等于n,且被7整除,不能被4整除,算出这个数。
Code:
#include<bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; for ( ; n ; ) { if (n % 7 == 0 && n % 4 != 0) { cout << n << '\n'; return ; } n ++; } return ; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int T; cin >> T; while (T--) { solve(); } return 0; }
F - Abbreviation (签到题)
思路:
去除a e i y o u, 但是不包括首字母 比如aa 输出第二个a.
Code:
#include<bits/stdc++.h> using namespace std; string a = "aeiyou"; void solve() { string s; cin >> s; cout << s[0]; for (int i = 1; i < s.size(); i++) { bool ok = 1; for (char x : a) { if (x == s[i]) { ok = 0; } } if (ok) cout << s[i]; } cout << '\n'; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int T; cin >> T; while (T--) { solve(); } return 0; }
标签:Provincial,cout,namespace,Joker,Zhejiang,solve,include From: https://www.cnblogs.com/youhualiuh/p/18122303