题解 CF 1372A
题目
题意
构造一个长度为n的数组,对于数组中的元素a,b,c,满足\(a+b\neq c\)。
思路
直接让数组中的数全部变成1就可以了(其他数也行)。
代码
/*
* Author :Werner_Yin
* Time: 2020-07-11 23:13:36
* I believe I can AC !
*/
#include <bits/stdc++.h>
#define lol long long
#define GDB(x) cout<<"DATA "<<#x<<" :"<<x<<endl;
#define mes(x) memset(x,0,sizeof(x))
using namespace std;
template <typename T>
void re(T &x){
#define ge getchar()
x = 0;int sgn = 1;char ch = ge;
for(;!isdigit(ch);ch = ge) if(ch == '-') sgn = -1;
for(;isdigit(ch);ch = ge) x = (x<<1)+(x<<3)+(ch^48);
x *= sgn;
}
template <typename T>
void write(T x){
if(x == 0) putchar(48);
else if(x < 0) putchar('-');
int k = 0,que[20];
while(x > 0){
que[++k]=x % 10;
x /= 10;
}
for(int i = k;i > 0;i--) putchar(que[i] + 48);
return;
}
int main (){
int T;
re(T);
while(T--){
int n;
re(n);
for(int i = 0;i < n;i++) cout<<1<<" ";
cout<<endl;
}
return 0;
}
题解 CF 1372A的更多相关文章
- 竞赛题解 - CF Round #524 Div.2
CF Round #524 Div.2 - 竞赛题解 不容易CF有一场下午的比赛,开心的和一个神犇一起报了名 被虐爆--前两题水过去,第三题卡了好久,第四题毫无头绪QwQ Codeforces 传送门 ...
- 题解——CF Manthan, Codefest 18 (rated, Div. 1 + Div. 2) T5(思维)
还是dfs? 好像自己写的有锅 过不去 看了题解修改了才过qwq #include <cstdio> #include <algorithm> #include <cst ...
- 竞赛题解 - [CF 1080D]Olya and magical square
Olya and magical square - 竞赛题解 借鉴了一下神犇tly的博客QwQ(还是打一下广告) 终于弄懂了 Codeforces 传送门 『题目』(直接上翻译了) 给一个边长为 \( ...
- [题解] [CF 1250J] The Parade
题面 题目大意: 给定一个 \(n\) , 所有军人的数量均在 \([1, n]\) 给定 \(a_i\) 代表高度为 \(i\) 的军人的个数 你要将这些军人分成 \(k\) 行, 满足下面两个条件 ...
- 题解 CF 1372 B
题目 传送门 题意 给出 \(n\),输出 \(a\) ,\(b\) (\(0 < a \leq b < n\)),使\(a+b=n\)且 \(\operatorname{lcm}(a,b ...
- 题解——CF Manthan, Codefest 18 (rated, Div. 1 + Div. 2) T4(模拟)
随便模拟下就过了qwq 然后忘了特判WA了QwQ #include <cstdio> #include <algorithm> #include <cstring> ...
- 题解——CF Manthan, Codefest 18 (rated, Div. 1 + Div. 2) T3(贪心)
是一道水题 虽然看起来像是DP,但其实是贪心 扫一遍就A了 QwQ #include <cstdio> #include <algorithm> #include <cs ...
- 题解——CF Manthan, Codefest 18 (rated, Div. 1 + Div. 2) T2(模拟)
题目要求很简单,做法很粗暴 直接扫一遍即可 注意结果会爆int #include <cstdio> #include <algorithm> #include <cstr ...
- 题解——CF Manthan, Codefest 18 (rated, Div. 1 + Div. 2) T1(找规律)
就是找一下规律 但是奈何昨天晚上脑子抽 推错了一项QwQ 然后重新一想 A掉了QwQ #include <cstdio> #include <algorithm> #inclu ...
随机推荐
- 2.WebPack初始化
一.Package.json 在项目中输入: npm init 之后会提示你一步一步输入信息,我输入的信息如下: 生成的Package.json文件如下 我们也可以在初始时省略这些步骤,让脚本使用默认 ...
- Docker编写镜像 发布个人网站
推荐国内镜像中心:网易云镜像----> https://c.163.com/hub#/home 或者歪果镜像---> https://hub.docker.com/ 博客地址:http: ...
- CSS背景颜色透明
{ filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity: 0.5; opacity: 0.5; } 兼容大部分主流浏览器 filter ...
- mackdown基础语法
目录 前言 二.Markdown基本语法 前言 由于有些语法无法在博客园展示,推荐使用Typora解锁全套,下载地址:https://www.typora.io/ Markdown是一种可以使用普通文 ...
- WSL配置高翔vslam环境
WSL配置高翔vslam环境 步骤: 安装 windows wls 配置 g++ cmake 环境 编译运行一下例子 1. window启用 wsl 前往 "启用或关闭 Windows 功能 ...
- 【Oracle】arraysize的研究(存在疑问)
arraysize的研究(存在疑问) SYS@proc> create table aaa (id1 int,id2 int,id3 int,id4 int); Table created. S ...
- html table表格斜线表头的实现方法总汇
在html中给table加一个斜线的表头有时是很有必要的,但是到底该怎么实现这种效果呢?总结了以下几种方法: 1.UI背景图实现 直接去找公司的UI,让她做一张图片,作为背景图片放到这里,然后撑满就可 ...
- windows php5.5安装redis扩展,并用redis存储session
1.确定安装版本 先通过phpinfo()查看php的Compiler.Architecture.Thread Safety,其中Thread Safety如果是enabled,那么就是线程安全(ts ...
- (一)ansible 安装配置
CentOS 7.5 一,安装 yum -y install ansible 二,配置hosts文件 /etc/ansible/hosts s1 ansible_ssh_port= ansible_s ...
- 线性dp—奶牛渡河
题目 Farmer John以及他的N(1 <= N <= 2,500)头奶牛打算过一条河,但他们所有的渡河工具,仅仅是一个木筏. 由于奶牛不会划船,在整个渡河过程中,FJ必须始终在木筏上 ...