10 2024 档案

摘要:A. 早餐 print("39.20") B. 水论文 #define int long long signed main() { int n,k; cin >> n >> k; set<int> st; int ans = 0; st.insert(n); for(int i = 0, t = n 阅读全文
posted @ 2024-10-24 18:20 橙之夏 阅读(408) 评论(0) 推荐(1)
摘要:A. 左移 #include<bits/stdc++.h> using namespace std; int main() { int T; cin >> T; while(T--) { string s; cin >> s; int ans = -1; if(s.front() == s.back 阅读全文
posted @ 2024-10-20 21:26 橙之夏 阅读(224) 评论(0) 推荐(0)
摘要:A. Orange的作文排版 关于处理若干行输入,我们可以用while结合getline函数来完成,每次读取一行,就让行数+1,然后每次利用string的size方法得到当前行的列数,更新最长的列,最后得到答案。 #include<bits/stdc++.h> using namespace std 阅读全文
posted @ 2024-10-14 09:16 橙之夏 阅读(194) 评论(0) 推荐(0)
摘要:处理一行输入 C++的cin和C语言的scanf函数都以空格为分隔符,读取输入,每次读到空格或者换行符就会停止。因此,当我们要输出的一整行包含空格时,以上函数均无法得到正确的结果。 string s; cin >> s; cout << s; 输入: hello world 输出: hello 为了 阅读全文
posted @ 2024-10-14 08:32 橙之夏 阅读(136) 评论(0) 推荐(0)
摘要:A.字符串拼接 直接拼接两个字符串即可,注意的是字符串可能包含空格,因此需要使用getline函数进行输入。 #include <bits/stdc++.h> using namespace std; int main() { string s1, s2; getline(cin, s1); get 阅读全文
posted @ 2024-10-10 14:05 橙之夏 阅读(721) 评论(0) 推荐(0)