ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined)

【解题报告】ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) 简略的解题报告。 阅读详情

A

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <utility>

using namespace std;
typedef long long ll;
const int qq = 1e5 + 10;
int n, m;
string a, b;
string c, d;

int main(){
	cin >> a >> b;
	cout << a << " " << b << endl;
	cin >> n;
	for(int i = 0; i < n; ++i){
		cin >> c >> d;
		if(c == a){
			a = d;
			cout << a << " " << b << endl;
		}	
		else if(c == b){
			b = d;
			cout << a << " " << b << endl;
		}else if(d == a){
			a = c;
			cout << a << " " << b << endl;
		}else if(d == b){
			b = c;
			cout << a << " " << b << endl;
		}
	}
	return 0;
}

B

題意:要求一個數和它的所有質因子的顏色不一樣,  要你輸出最少使用多少顏色, 以爲每一個數使用了哪種顏色

我們知道一個數的質因子之間都是互質的, 那麼我們得知如果所有質數都爲顏色1, 那麼其他數只要爲顏色2就可以得解

注意一下只需要用一種顏色的情況

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <utility>

using namespace std;
typedef long long ll;
const int qq = 1e5 + 10;
int n, m;
int prime[30] = {2, 3, 5, 7, 11, 13, 17, 19, 21, 23, 29, 31};
int vis[qq];
bool isprime[qq];

int main(){
	memset(isprime, true, sizeof(isprime));
	memset(vis, 0, sizeof(vis));
	isprime[1] = false;
	int n;	scanf("%d", &n);
	if(n == 1){
		printf("1\n");
		printf("1\n");
		return 0;
	}
	if(n == 2){
		printf("1\n1 1\n");
		return 0;
	}
	n++;
	for(int i = 2; i <= n; ++i){
		if(isprime[i])
			for(int j = i + i; j <= n; j += i)
				isprime[j] = false;
	}
	printf("2\n");
	for(int i = 2; i <= n; ++i)
		if(isprime[i])	printf("1 ");
		else	printf("2 ");
	puts("");
	return 0;
}

C

題意:要你求有多少個區間的和爲k^n此方(n >= 0)

這裏利用了一些數的特性, 說實話我覺得真的設計的很巧妙

對於某個前綴pre[i]我們處理出所有k^n + pre[i]的結果

那麼對於前綴pre[j] 我們知道 如果pre[j] = k^n + pre[i] 及 pre[j] - pre[i] = k^n

那麼區間[i, j] 即存在解

我們只需要統計計數就好了

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <utility>

using namespace std;
typedef long long ll;
const int qq = 1e5 + 10;
ll num[qq];
ll powk[qq];
ll pre[qq];
map<ll, ll> mp;
ll n, k;
#define sf(x) scanf("%lld", &x);
#define REP(i, x, n)	for(int i = x; i < n; ++i)

int main(){
	sf(n);	sf(k);
	for(int i = 1; i <= n; ++i)
		sf(num[i]);
	powk[0] = 1;
	int cnt = 1;
	if(k == -1){
		++cnt;
		powk[1] = -1;
	}else if(k != 1){
		cnt = 1;
		ll t = 1;
		while(abs(t) < 1e15){
			powk[cnt++] = t * k;
			t = t * k;
		}
	}
	REP(i, 0, cnt)	mp[powk[i]]++;
	ll ans = 0;
	for(int i = 1; i <= n; ++i){
		pre[i] = pre[i - 1] + num[i];
		ans += mp[pre[i]];
		for(int j = 0; j < cnt; ++j)
			mp[pre[i] + powk[j]]++;
	}
	printf("%lld", ans);
	return 0;
}


内窥镜胶囊(胶囊内镜)硬件方案 内窥镜胶囊(胶囊内镜)硬件方案 前言 说明:该方案为作者2018年上半年完成的第一版,后来搁置了一段时间,才重启这个项目。目前(2020.07)第二版已经快要完成。[联系v:1#7#6#3#3#3#5#0#8#7#0]先给一下第一版和第二版的基本参数。 第一版: 续航时间:3h 帧率:0.5fps 尺寸:12mm * 25mm 角度:45° 第二版: 续航时间:12h 帧率:2-6fps 尺寸:9.8mm * 25mm 角度:130° 第一版属于尝试版,整体方案不是很成熟。第二版这个数据就非常优秀了。我拿了 阅读详情

相关推荐

Dataworks实现接口调用

在本地linux虚拟机(不用在意linux版本),安装Anaconda后配置对应的虚拟环境,将虚拟环境的python包整体打包(路径一般为:~/anaconda/envs/env_name/lib/pyyhon3.7/site-packages):上传资源,将第三方包上传至dataworks(注意:所有上传文件均要打包上传,直接上传文件会乱码导致无法使用):PyODPS,其中PyODSP2的python版本为2.7,PyODSP3的python版本为3.7。:在PyODPS中引用资源,然后开发接口。

hutc_Alan的博客 1694

【前缀和 && 思维转换】ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined)Molly's Chemicals

Problem Description 输入n, k代表有n个元素,问你任意取一段区间和 满足k的m次方(m是任意正整数)让你求出:有多少段不同的区间和? 思路: 第一想法能想到的就是前缀和然后 sum[i] - sum[j] = pow[k] i: 1 to n; j : 0 to (i - 1); k : 0 to m;这样复杂度肯定会超时。于是就没想到了,然后百度借鉴借鉴。将公式转化成

ACMer 梁剑锋 的博客 786

SRv6项目实践(三):P4Runtime基础以及交换机控制

在正式介绍P4runtime基础之前,先说一说P4的编译和实现的过程该文件包含了各个表和操作,它们的id用一个索引值来表示,比如a表用b操作,不会直接说用名字为B的操作,而是说用索引为xxx的操作,然后锁定到b上执行相关的功能,其次,用了一个bitwith来描述,要访问的数据的比特长度是多长。p4c编译器将p4编译成两份文件,其中一份是,另一份是,将这两个文件再整合起来,作为配置,放到交换机中。

a1164520408的博客 3414

ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) E. The Holmes Children

#include <iostream> #include <stdio.h> #include <string.h> #include <stack> #include <queue> #include <map> #include <set> #include <vector> #include <math.h> #include <bitset>

我们仍未知道那天所看见的花的名字。 345

PyCharm 配置 Anaconda 环境时找不到 python.exe 的解决办法

通过本文的排查步骤与详细解决方案,你应该能够迅速定位并修复 PyCharm 配置 Anaconda 环境时找不到 python.exe 的问题。确保正确设置环境路径、激活目标环境以及手动指定解释器路径是解决此问题的关键。随着开发工具与包管理器的不断更新,类似的问题可能会出现新的变体。持续关注官方文档、社区讨论和版本更新,可以帮助开发者及时适应新变化,并优化工作流程。希望本文提供的分析和代码示例能为你的开发环境配置带来帮助,让你在 PyCharm 与 Anaconda 的高效协同下,专注于创新与代码实现。

s13596191285的博客 3124

基于ResNet + LLM大语言模型的分类识别系统设计与实现,Web前后端分离,Django+vue3+AI助手模块+ResNet50算法+LLM 联动+Element Plus等技术,全网独发

分类识别任务是计算机视觉中的重要任务,广泛应用于智慧校园分类、智慧农业、智慧生活场景分类等领域。常见的分类模型有 VGGNet、ResNet 、MobileNet 、ConvNeXt、DenseNet、ViT、Swin Transformer、YOLOv8/11/26。本项目结合 ResNet分类识别算法 + LLM大语言模型联动 ,使用 Django + Vue3,构建了一个通用的 Web 前后端系统,用户端 + 管理端 ,便于用户操作检,不仅可以用于大论文的工作量展示,还可以作为毕业设计。

在职AI算法工程师,擅长计算机视觉,YOLO目标检测、分割等,擅长web、pyqt界面可视化,好内容持续更新中,来这里跟大家一起学习,共同进步 843

ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) D. The Door Problem 并查集

题目:https://codeforces.com/contest/776/problem/D 题意: 有n个房间,由m个开关控制。每个房间一定是由两个开关控制。每个房间有一个初始的是否解锁的状态。问你能否让所有房间都解锁。 题解: 若控制一个房间的开关为a,b。一个开关若开为a,不开为a+m。则若房间原来开着,就为(a,b)或(a+m,b+m)。原来没开就为(a,b+m)或(a+m,b)。...

Niconicoqaq的博客 465

50、压电微泵与技术设备驱动的研究分析

本文研究了压电微泵在弹性微通道中的流体流动特性及技术设备驱动的振动行为。通过建立轴对称流固耦合模型,利用FreeFem++进行数值模拟,分析了不同数量压电致动器和频率对微泵流量的影响,发现多个致动器按特定时序压缩可产生净正向流量,并提出了稳态流量的近似解析公式。同时,针对技术设备驱动系统,探讨了周期性负载引起的强迫振动特性,明确了共振条件及影响因素,并比较了主动、被动和优化设计等振动控制策略。最后展望了实验验证、多物理场耦合与智能控制等未来研究方向,为相关设备的优化设计与高效运行提供了理论支持。

convnet3designer的博客 152

[Updating]ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined)

Problem A-A Serial Killer 模拟 //Author: Lixiang #include #include struct A_Serial_Killer{ char now[2][11]; int N; void init(){ scanf("%s%s",now[0],now[1]); scanf("%d",&N); } bool cmp(char a[

理想之国 991

人工智能训练师三级考试大纲深度解读|理论+实操分值分布+六大模块占比

三级人工智能训练师考试分为理论和实操两大模块(各100分,合格线60分)。理论考试包含AI基础(30%)、数据标注(25%)、模型训练(20%)、测试(15%)和系统运维(10%),题型为客观题;实操考核侧重数据标注(40%)、模型测试(35%)和系统运维(25%),采用现场操作形式。复习应优先关注AI基础和数据标注等高分值模块,实操需重点掌握标准流程和结果准确性(占评分70%)。考试要求两模块均达标,理论侧重概念理解,实操强调规范执行与文档完整。

白话机器学习 1166

GEE训练教程:如何批量从Google assets中将时序影像批量导出到Google drive

本文介绍了一种使用Google Earth Engine(GEE)批量导出2000-2023年叶绿素a(Chl-a)浓度数据的方法。通过JavaScript代码自动生成多个年份的导出任务,将数据保存至Google Drive指定文件夹。文章详细说明了代码参数配置、使用步骤和注意事项,包括资产命名规则验证、导出任务启动方式,以及分辨率、区域范围等关键参数的调整建议。同时提供了常见问题的解决方案,如处理缺失年份数据、解决导出像素超限等问题。该方法可显著提高多年份Chl-a数据批量导出的效率,适用于水体环境研究的

此星光明博客 94

ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) B

Sherlock has a new girlfriend (so unlike him!). Valentine's day is coming and he wants to gift her some jewelry. He boughtnpieces of jewelry. Thei-th piece has price equal toi + 1, that is...

514

UDS自动化测试-Service 0x27(CAPL调用dll实现key计算)

相信读者基于Diagnostic/ISO TP Confighration中cdd、dll文件的测试并不陌生,本文基于其的基础上,介绍在capl中调用内置的函数diagGenerateKeyFromSeed实现27服务解锁,从而进行诊断自动化测试。本文基于4个byte的Seed、16个byte的Key的安全访问,实现27服务的自动化测试。需要加载项目使用的cdd文件,如果没有的情况下可以使用canoe例程中默认的cdd文件。

诊断协议那些事儿's blog 2056

ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) C. Molly's Chemicals

Molly’s Chemicals time limit per test 2.5 seconds memory limit per test 512 megabytes Description Molly Hooper has n different kinds of chemicals arranged in a line. Each of the chemicals has

喵喵喵? 903

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) C

Molly Hooper hasndifferent kinds of chemicals arranged in a line. Each of the chemicals has an affection value, Thei-th of them has affection valueai. Molly wants Sherlock to fall in love ...

285

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) D. The Door Problem(种类并查集)

题目链接 思路:种类并查集模板题,如果i表示关,i+m就是它的对立面就是开。 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn =1e5+5; int n,m,pos,t,a[maxn],father[maxn<<1]; vector<int>...

qq_42479630的博客 782

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) C. Molly's Chemicals

题目链接 C. Molly's Chemicals time limit per test 2.5 seconds memory limit per test 512 megabytes input standard input output standard output Molly Hooper has n different

fouzhe的博客 506

ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined)A+B

A. A Serial Killertime limit per test:2 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputOur beloved detective, Sherlock is currently trying to catch a serial killer

妍恐龙的博客....^~^眼熟我 594

CF变红之路_ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined)

从今天开始刷CF,从round400 开始,div1,2,3都要做,并记录自己的刷题进度,限时刷题(像比赛一样)+ 补题, 以此记录我的CF变紫之路。 A #include &amp;amp;amp;amp;amp;amp;lt;bits/stdc++.h&amp;amp;amp;amp;amp;amp;gt; using namespace std; typedef pair&amp;amp;amp;amp;amp;amp;lt;string, string&amp;

sunmaoxiang的博客 435

【codeforces】ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined)

  2018-01-31   题目链接:http://codeforces.com/contest/776   官方题解:http://codeforces.com/blog/entry/50622 【A】水题,按照题意即可 #include<iostream> #include<cstdio> #include<string> u...

weixin_30872789的博客 145

ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) 解题报告

A:A Serial Killer 1 #include <iostream> 2 //#include<bits/stdc++.h> 3 #include <stack> 4 #include <queue> 5 #include <map> 6 #include <set> 7 #inc...

weixin_30536513的博客 261

ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) C. Molly‘s Chemicals

#include<bits/stdc++.h> using namespace std; #define X first #define Y second #define eps 1e-2 #define gcd __gcd #define pb push_back #define PI acos(-1.0) #define lowbit(x) (x)&(-x) #define bug printf("!!!!!\n"); #define mem(x,y) memset(x,y,s

我们仍未知道那天所看见的花的名字。 699

ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) 题解(A-E)

A A Serial Killer#include<bits/stdc++.h> using namespace std; #define For(i,n) for(int i=1;i<=n;i++) #define Fork(i,k,n) for(int i=k;i<=n;i++) #define Rep(i,n) for(int i=0;i<n;i++) #define ForD(i,n) fo

nike0good |Oier&ACMer | 熟能生巧 981
上一篇: Codeforces Round #401 (Div. 2)
下一篇: RMQ
Yokile_
博客等级 码龄11年 37粉丝 245原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值