Codeforces Global Round 6[A,B,C]

题意:给一个字符串,对它重新排列使得它是60的倍数。
模拟一下,需要能整除60 字符串中需要 能整除2 3 10,所以需要字符串各位数之和能整除3 并且有 一个偶数和一个0 或者两个0也行【没考虑到,WA到自闭QAQ】, 特殊情况 全为0 也行,
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int _;cin>>_;
while(_--){
string str;
cin>>str;
int flag=;int s=;
int flag1=;
for(int i=;i<str.size();i++){
if(str[i]==''){
flag++;
}
if((str[i]-'')%==&&(str[i]!='')){
flag1=;
}
s+=str[i]-'';
}
if((flag1&&s%==&&flag)||(s%==&&flag>=)){
cout<<"red"<<'\n';
}else{
cout<<"cyan"<<'\n';
}
}
return ;
} /* */

题意:给一个数,问他是不是可以由一个骰子塔的所有接触空气的面的数字构成。
思路:每一圈之和恒为14。则判断一下<14的就OK
#include<bits/stdc++.h>
using namespace std;
#define int long long signed main(){
int _;
cin>>_;
while(_--){ int n;
cin>>n;
if(n%<=&&n%>=&&n>=){
cout<<"YES";
}else{
cout<<"NO";
}
cout<<'\n';
}
return ;
}

题意:往一个矩阵里面填数,使得每行每列的gcd都两两各不相同。且最大的gcd最小。
思路:按照题意构造。
#include<bits/stdc++.h> using namespace std;
#define int long long
int arr[];
int mp[][];
signed main(){
int r,c;
cin>>r>>c;
if(r==&&c==){
cout<<"";
return ;
}
if(r==){
int num=;
for(int i=;i<=c;i++){
printf("%lld ",num);
num++;
}
}else if(c==){
int num=;
for(int i=;i<=r;i++){
printf("%lld\n",num);
num++;
}
}else{
int num=c+;
for(int i=;i<=r;i++){
arr[i]=num;
num++;
}
for(int i=;i<=c;i++){
for(int j=;j<=r;j++){
mp[j][i]=i*arr[j];
}
}
for(int i=;i<=r;i++){
for(int j=;j<=c;j++){
printf("%lld ",mp[i][j]);
}
printf("\n");
}
}
return ;
}
Codeforces Global Round 6[A,B,C]的更多相关文章
- CodeForces Global Round 1
CodeForces Global Round 1 CF新的比赛呢(虽然没啥区别)!这种报名的人多的比赛涨分是真的快.... 所以就写下题解吧. A. Parity 太简单了,随便模拟一下就完了. B ...
- Codeforces Global Round 1 - D. Jongmah(动态规划)
Problem Codeforces Global Round 1 - D. Jongmah Time Limit: 3000 mSec Problem Description Input Out ...
- Codeforces Global Round 2 题解
Codeforces Global Round 2 题目链接:https://codeforces.com/contest/1119 A. Ilya and a Colorful Walk 题意: 给 ...
- Codeforces Global Round 1 (A-E题解)
Codeforces Global Round 1 题目链接:https://codeforces.com/contest/1110 A. Parity 题意: 给出{ak},b,k,判断a1*b^( ...
- Codeforces Global Round 3
Codeforces Global Round 3 A. Another One Bites The Dust 有若干个a,有若干个b,有若干个ab.你现在要把这些串拼成一个串,使得任意两个相邻的位置 ...
- Codeforces Global Round 1 (CF1110) (未完结,只有 A-F)
Codeforces Global Round 1 (CF1110) 继续补题.因为看见同学打了这场,而且涨分还不错,所以觉得这套题目可能会比较有意思. 因为下午要开学了,所以恐怕暂时不能把这套题目补 ...
- 【手抖康复训练1 】Codeforces Global Round 6
[手抖康复训练1 ]Codeforces Global Round 6 总结:不想复习随意打的一场,比赛开始就是熟悉的N分钟进不去时间,2333,太久没写题的后果就是:A 题手抖过不了样例 B题秒出思 ...
- Codeforces Global Round 11 个人题解(B题)
Codeforces Global Round 11 1427A. Avoiding Zero 题目链接:click here 待补 1427B. Chess Cheater 题目链接:click h ...
- 【Codeforces Round 1110】Codeforces Global Round 1
Codeforces Round 1110 这场比赛只做了\(A\).\(B\).\(C\),排名\(905\),不好. 主要的问题在\(D\)题上,有\(505\)人做出,但我没做出来. 考虑的时候 ...
- 树形DP ---- Codeforces Global Round 2 F. Niyaz and Small Degrees引发的一场血案
Aspirations:没有结果,没有成绩,acm是否有意义?它最大的意义就是让我培养快速理解和应用一个个未知知识点的能力. ————————————————————————————————————— ...
随机推荐
- 为什么Redis单线程却能支撑高并发?
作者:Draveness 原文链接:draveness.me/redis-io-multiplexing 最近在看 UNIX 网络编程并研究了一下 Redis 的实现,感觉 Redis 的源代码十分适 ...
- git及gitflow命令备忘
全文xxx表示你的分支名 一.git 删除本地分支 git branch -d xxx 删除远程分支 git push origin --delete xxx 查看所有分支 本地分支 git bran ...
- Docker3-Dockerfile创建镜像的方法(推荐docker file这种方法)
一.镜像制作的方法 1.本地导入导出镜像 请参考:Docker 架构原理及简单使用 导出:docker save nginx >/tmp/nginx.tar.gz 导入:docker load ...
- Java内存模型——方法区
方法区(Method Area) ① 对每个加载的类型,JVM必须在方法区中存储以下类信息: 1) 这个类型的完整有效名(类型信息) 类型名称在Java类文件和JVM中都以完整 ...
- centos7.5 离线安装ntp服务
安装 #检查rpm包 rpm -qa | grep ntp #从https://pkgs.org/download/ntp 下载rpm包 ntp-4.2.6p5-28.el7.centos.x86_6 ...
- ADO.NET 三(Command)
操作数据库需则要用到 Command 类中提供的属性和方法.下面来介绍一下如何使用 Command 类来操作数据表中的数据. Command 类概述 在 System.Data.SqlClient 命 ...
- vue.js相关教程
Vue.js——60分钟快速入门 http://www.cnblogs.com/keepfool/p/5619070.html
- org.apache.commons.beanutils.ConversionException: No value specified解决办法
转自:https://www.cnblogs.com/linjiqin/archive/2011/07/21/2112628.html 当用到了java.sql.Date时间等非内置对象时,如果对象为 ...
- Linux下用的脚本
http://blog.itpub.net/29510932/viewspace-1166603/ 批量启动Tomcat 点击(此处)折叠或打开 #!/bin/bash #JDK路径 export J ...
- Python——2x和3x的区别汇总
1. 初始解释器编码: 2x:ascii 编码(不自持中文) 3x:unicode编码 推荐全部更换为utf-8 2. 输出方式不同 2x:print ‘你好’2.7版本的两种都支持 3x:print ...