这两天抽时间去codeforces体验了一把。
首先,果然有众多大牛存在,很多名人一直参加每周一次的比赛,积分2000+,并参与出题。
另外,上面题目很多,估计至少一千题。比赛结束后,题目将转为练习题,可以持续尝试。每道题目都有标签,如greedy, math, matrices等等,可以点击相应的标签只做相关的题目。可惜我做了好几道之后才发现。
首次尝试,这次做的几个都是选的完成人数最多的,比较简单,但还是有些东西是从中新学习到的。以后最好分类练习。
#include
#include
using namespace std;
int main(){
long long m,n,a;
//cout << numeric_limits::max() << endl;
cin >> m >> n >> a;
cout << ((m-1)/a + 1)*((n-1)/a + 1) << endl;
return 0;
}
#include
#include
using namespace std;
int main(){
string str;
cin >> str;
ostringstream ostr;
for(auto i:str){
char t=tolower(i);
if(t == 'a' || t=='o' || t=='y'||t=='e' ||t=='u' || t=='i')
;
else
ostr<< '.' << t;
}
cout << ostr.str() << endl;
return 0;
}
#include
#include
using namespace std;
int main(){
int n;
cin >> n;
// can't initialize a vector with its element;
//vector test(1,2,3,4);
vector stat(4,0);
for(int i = 0;i < n;i++){
int tmp;
cin >> tmp;
stat[tmp-1] += 1;
}
int num_taxi = 0;
num_taxi += stat[3];
if(stat[2]>= stat[0]){
num_taxi += stat[2];
num_taxi += (stat[1]+1)/2;
}
else{
num_taxi += stat[2];
stat[0] -= stat[2];
num_taxi += (stat[0] + stat[1]*2 -1)/4 + 1;
}
cout << num_taxi << endl;
return 0;
}
#include
#include
using namespace std;
bool meet_rule(string s)
{
for(char &c:s.substr(1))
{
if(islower(c))
return false;
}
return true;
}
int main()
{
string s;
cin >> s;
if(meet_rule(s))
{
for(char &c:s)
{
if(true )
{
if(islower(c))
c = toupper(c);
else
c = tolower(c);
}
}
}
cout << s << endl;
return 0;
}