tim

洛谷P2827 蚯蚓

不羁的心 提交于 2019-12-04 09:24:33
传送门 pts85/90(90应该是个意外,第一次交是90之后都是85了): 优先队列模拟题意 #include<iostream> #include<cstdio> #include<queue> using namespace std; int n,m,q,u,v,t,tim; double p; priority_queue<int>qq; int main() { scanf("%d%d%d%d%d%d",&n,&m,&q,&u,&v,&t); p=1.0*u/(1.0*v); for(int i=1,x;i<=n;i++){ scanf("%d",&x); qq.push(x); } while(m--){ tim++; int x=qq.top(); qq.pop(); if(tim%t==0)printf("%d ",x+(tim-1)*q); int y=(int)(p*(double)(x+(tim-1)*q)); x=(x+(tim-1)*q)-y; qq.push(x-tim*q),qq.push(y-tim*q); } printf("\n"); int now=0; while(qq.size()){ now++; if(now%t==0){ printf("%d ",qq.top()+tim*q); } qq.pop(); } return 0; }

定时器中断

南楼画角 提交于 2019-12-04 06:34:41
1.定时器介绍 STM32F1的定时器非常多,由2个基本定时器(TIM6、TIM7)、4个通 用定时器(TIM2-TIM5)和2个高级定时器(TIM1、TIM8)组成。基本定 时器的功能最为简单,类似于51单片机内定时器。通用定时器是在基本 定时器的基础上扩展而来,增加了输入捕获与输出比较等功能。高级定 时器又是在通用定时器基础上扩展而来,增加了可编程死区互补输出、 重复计数器、带刹车(断路)功能,这些功能主要针对工业电机控制方面 1.1 通用定时器简介 STM32F1的通用定时器包含一个 16 位自动重载计数器(CNT),该计数器由可编程预分频器(PSC)驱动。STM32F1的通用定时器可用于多种 用途,包括测量输入信号的脉冲宽度(输入捕获)或者生成输出波形(输出 比较和PWM)等。 使用定时器预分频器和 RCC 时钟控制器预分频器,脉 冲长度和波形周期可以在几个微秒到几个毫秒间调整。STM32F1 的每个 通用定时器都是完全独立的,没有互相共享的任何资源。 STM32F1的通用定时器TIMx (TIM2-TIM5 )具有如下功能: (1)16 位向上、向下、向上/向下自动装载计数器(TIMx_CNT)。 (2)16 位可编程(可以实时修改)预分频器(TIMx_PSC),计数器时钟频率的分频系数为 1~65535之间的任意数值。 (3)4个独立通道(TIMx_CH1-4)

Is there any way to change the date/time as seen on the iOS simulator (other than changing Mac settings)?

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to do some testing that involves moving the "phone" backwards and forwards through several days. I'd like to do this on the simulator. Is there any available hack that allows the date as seen on the simulator to be changed, without having to change the Mac date? 回答1: Looks like it's pretty tough... How about using xcodebuild to automate building and running the app from a script and using systemsetup -setdate <mm:dd.yy> to change date in between different runs? Then you wouldn't need to change anything in code. 回答2: You can use method

Can&#039;t enter break mode at this time

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This has been happening increasingly, when I have a sheets.add or sheets.delete in excel VBA. After searching and searching I finally found the official Microsoft support page on it. My question is, does anyone know why I could have stepped through this code just fine over and over, and then all of a sudden it starts doing what Microsoft says it would always do, and is there a way to fix it? Sub foo() Sheets.add debug.print "sheet added" 'breakpoint here End sub It's as simple as that. You won't be able to recreate it, because the issue I'm

stm32F4 pwm input capture of high frequency signal approx. 2MHz?

匿名 (未验证) 提交于 2019-12-03 01:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to measure the frequency of a PWM signal. To do that, I'm using STM-F401RE and its Timer_Input_Capture function. The problem is: the input signal has a quite high frequency (approx. 2MHz) and, the STM-F401RE controller has only a 80MHz clock Therefore when using an interrupt routine for counting the number of rising edge of the input signal, it misses many rising edges (depending on the frequency of the input signal). When using an Oscilloscope and toggling an I/O-pin, I saw that it can only capture all the rising edge when the

STM32重映射和PWM控制

匿名 (未验证) 提交于 2019-12-03 00:13:02
由于玩STM32的时候很少用它的重映射功能,所以做项目的时候需要PWM控制光强,用的是PB5控制。看了下手册,这不是定时器的PWM通道管脚啊,后来在硬件的提醒下才想起来STM32管脚可以重映射,都忘了这茬了。唉!真是太菜。 TIM3_CH2 实际的引脚是 PA7 ,可以通过部分重映射到 PB5 ,这样就可以通过 PB5 输出PWM信号。 初始化代码: void LED_GPIO_Init ( void ) { GPIO_InitTypeDef GPIO_InitStructure ; RCC_APB2PeriphClockCmd ( RCC_APB2Periph_GPIOB , ENABLE ); GPIO_PinRemapConfig ( GPIO_PartialRemap_TIM3 , ENABLE ); //重映射PA7为PB5 GPIO_InitStructure . GPIO_Pin = GPIO_Pin_5 ; GPIO_InitStructure . GPIO_Mode = GPIO_Mode_AF_PP ; GPIO_InitStructure . GPIO_Speed = GPIO_Speed_2MHz ; GPIO_Init ( GPIOB , & GPIO_InitStructure ); } void LED_PWM_Init ( uint16_t arr

HTTP历史脉络

匿名 (未验证) 提交于 2019-12-02 23:47:01
HTTP协议最早由万维网之父Tim Berners-Lee提出。 1991.8.6日,Tim Berners-Lee在位于欧洲粒子物理研究所(CERN)的NeXT计算机上,正式公开运行世界上第一个web网站(http://info.cern.ch),建立起基本的互联网基础概念和技术体系。 HTTP 0.9:单行协议 1991年,Tim根据自己的实现,写了一篇关于HTTP协议的文章,这篇文章后来被看成是HTTP/0.9版本。详见: https://www.w3.org/Protocols/HTTP/AsImplemented.html 规定了HTTP使用的TCP/IP连接 HTTP请求只有一个请求行 只有一个GET方法加上请求的URI HTTP响应则直接返回HTML文本,没有状态码,所以也没有办法区分错误消息和正常的文本 HTTP/ 1.0:快速增长和Informational RFC

stm32学习PWM输出

匿名 (未验证) 提交于 2019-12-02 23:40:02
//TIM3 PWM 部分初始化 //PWM 输出初始化 //arr:自动重装值 //psc:时钟预分频数 void TIM3_PWM_Init(u16 arr,u16 psc) { GPIO_InitTypeDef GPIO_InitStructure; TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; TIM_OCInitTypeDef TIM_OCInitStructure; RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); //①使能定时器 3 时钟(改) RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_AFIO, ENABLE); //①使能 GPIO 和 AFIO 复用功能时钟(改) GPIO_PinRemapConfig(GPIO_PartialRemap_TIM3, ENABLE); //②重映射 TIM3_CH2->PB5 (需要重映射就加) //设置该引脚为复用输出功能,输出 TIM3 CH2 的 PWM 脉冲波形 GPIOB.5,初始化GPIO B5 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5; //TIM_CH2(改) GPIO

The Zen of Python, by Tim Peters

匿名 (未验证) 提交于 2019-12-02 22:11:45
Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never

STM32重映射和PWM控制

不想你离开。 提交于 2019-11-30 20:00:17
由于玩STM32的时候很少用它的重映射功能,所以做项目的时候需要PWM控制光强,用的是PB5控制。看了下手册,这不是定时器的PWM通道管脚啊,后来在硬件的提醒下才想起来STM32管脚可以重映射,都忘了这茬了。唉!真是太菜。 TIM3_CH2 实际的引脚是 PA7 ,可以通过部分重映射到 PB5 ,这样就可以通过 PB5 输出PWM信号。 初始化代码: void LED_GPIO_Init(void) { GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); GPIO_PinRemapConfig(GPIO_PartialRemap_TIM3,ENABLE); //重映射PA7为PB5 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_Init(GPIOB, &GPIO_InitStructure); } void LED_PWM_Init(uint16_t arr,uint32_t ck_cnt,uint16_t CCR2