【day03】简写单词 | dd爱框框 | 除2!
1、简写单词
题目链接:简写单词_牛客题霸_牛客网
解题思路:简单的模拟
#include <bits/stdc++.h>using namespace std;#define int long longsigned main()
{string s;while(cin >> s){if(s[0] <= 'z' && s[0] >= 'a') cout << char(s[0] - 32);else cout << s[0];}return 0;
}
2、dd爱框框
题目链接:dd爱框框
解题思路:基础的同向双指针
#include <bits/stdc++.h>using namespace std;const int N = 1e7 + 10;
int arr[N];
int n , x;int main()
{
… }cout << retleft << " " << retright << endl;return 0;
}
3、除2!
题目链接:除2!
解题思路:小贪心 + 堆
#include <bits/stdc++.h>using namespace std;#define int long longint n , k;
priority_queue<int> heap;signed main()
… {int t = heap.top() / 2;heap.pop();sum -= t;if(t % 2 == 0) heap.push(t);}cout << sum << endl;return 0;
}