易错点 测试点4超时 解决方案 tmps=tmps+tmpc+to_string(tmp); 改成 tmps+=tmpc+to_string(tmp); 原因 a+=b比a=a+b快很多! 因此+=的形式不仅仅是代码书写习惯的问题,关系到代码运行速度,可以尽量写成+=的形式。 代码 #include <iostream> #include <cstdio> #include <string> usi
代码 #include <iostream> #include <cstdio> #include <cmath> using namespace std; int r[10001]; int main() { int n; int a; for(int i=0;i<10001;i++){ r[i]=0; } cin>>n; for(int i=0;i<n;i++){ cin>>a; r[abs(i+1-a)
题目:1084 外观数列 (20 分) 来源:PAT (Basic Level) Practice 传送门 1084 外观数列 题面 题意:给定d,n,按给定规律求第n项 思路:感觉就是一种行压缩,详细见代码 Code 点击查看代码 #include <bits/stdc++.h> using namespace std; int main(){ string d; int n,k; cin>>
1084:幂的末尾 时间限制: 1000 ms 内存限制: 65536 KB 提交数: 39605 通过数: 23022 【题目描述】 幂abab的末33位数是多少? 【输入】 两个正整数a,ba,b。1≤a≤100,1≤b≤100001≤a≤100,1≤b≤10000。 【输出】 从高位到低位输出幂的末三位数字,中间无分
POJ - 1084 Square Destroyer #include <cstdio> #include <cstring> #include <vector> using namespace std; const int N = 61; // 网格最大是 5 * 5 的,其中最多会有 5 * (5 + 1) * 2 = 60 个正方形,所以要开到 61 int n, idx; // n 为网格规模,idx 为正
题目传送门 #include <bits/stdc++.h> using namespace std; const int N = 15; const int M = 110; //mod N=0 N=100 int l, r, n; int a[N]; int dp[N][M]; int dfs(int pos, int sum, bool limit) { if (pos == -1) return !(sum % n); if (!limit &&
1083 编写函数计算阶乘 法一: 法二: 1124 函数中的变量 1059 [填空题]函数定义 1084 [填空题]十进制数转二进制数 法一: 法二: 1151 求函数值
1084: 计算两点间的距离(多实例测试) 时间限制: 1 Sec 内存限制: 128 MB 提交: 27531 解决: 15018 [状态] [讨论版] [提交] [命题人:admin] 题目描述 入两点坐标(X1,Y1),(X2,Y2),计算并输出两点间的距离。 输入 输入数据有多组,每组占一行,由4个实数组成,分别表示x1,y1,x2,y2,数据之间
一、DTMF简介 1 含义 双音多频 DTMF(Dual Tone Multi Frequency),双音多频,由高频群和低频群组成,高低频群各包含4个频率。一个高频信号和一个低频信号叠加组成一个组合信号,代表一个数字。DTMF信令有16个编码。利用DTMF信令可选择呼叫相应的对讲机。 双音多频信号(DTMF),电话系统中电
1084: 计算两点间的距离(多实例测试) import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); while(cin.hasNext()) { double x1=cin.nextDouble();
方法一: select product_id,product_name from ( select a.product_id,product_name, case when sale_date<='2019-03-31' and sale_date>='2019-01-01' then 0 else 1 end d #case when sale_date between '2019-
题目描述 入两点坐标(X1,Y1),(X2,Y2),计算并输出两点间的距离。 输入 输入数据有多组,每组占一行,由4个实数组成,分别表示x1,y1,x2,y2,数据之间用空格隔开。 输出 对于每组输入数据,输出一行,结果保留两位小数。 样例输入 Copy 0 0 0 1 0 1 1 0 样例输出 Copy 1.00 1.4
PAT乙级:1084 外观数列 (20分) 题干 外观数列是指具有以下特点的整数序列: d, d1, d111, d113, d11231, d112213111, ... 它从不等于 1 的数字 d 开始,序列的第 n+1 项是对第 n 项的描述。比如第 2 项表示第 1 项有 1 个 d,所以就是 d1;第 2 项是 1 个 d(对应 d1)和 1 个 1
On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen. Now given a string that you are supposed to type, and the string that you actually type out, plea
On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen. Now given a string that you are supposed to type, and the string that you actually type out, please
题意: 输入两行字符串,输出第一行有而第二行没有的字符(对大小写不敏感且全部以大写输出)。 代码: #define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h>using namespace std;string s1,s2;bool vis[507];vector<char>ans;int main(){ ios::sync_with_stdio(false); cin.tie(NUL
Description 这里有一个n*m的矩阵,请你选出其中k个子矩阵,使得这个k个子矩阵分值之和最大。注意:选出的k个子矩阵不能相互重叠。 Input 第一行为n,m,k(1≤n≤100,1≤m≤2,1≤k≤10),接下来n行描述矩阵每行中的每个元素的分值(每个元素的分值的绝对值不超过32767)。 Output
1084 Broken Keyboard (20 分) On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen. Now given a string that you are supposed to type, and the string tha
1、题目描述 Write an SQL query that reports the products that were only sold in spring 2019. That is, between 2019-01-01 and 2019-03-31 inclusive. The query result format is in the following example: Product table: product_id product_name unit_price
Description The left figure below shows a complete 3*3 grid made with 2*(3*4) (=24) matchsticks. The lengths of all matchsticks are one. You can find many squares of different sizes in the grid. The size of a square is the length of its side. In the grid
#include <bits/stdc++.h>using namespace std;int main(){ int a,b; scanf("%d %d",&a,&b); vector<int> v1; vector<int> v2; v1.push_back(a); b--; while(b--) { v2.clear(); int count = 1;
外观数列是指具有以下特点的整数序列: d, d1, d111, d113, d11231, d112213111, ... 它从不等于 1 的数字 d 开始,序列的第 n+1 项是对第 n 项的描述。比如第 2 项表示第 1 项有 1 个 d,所以就是 d1;第 2 项是 1 个 d(对应 d1)和 1 个 1(对应 11),所以第 3 项就是 d111。又比如第 4
这几天电脑上突然自动安装pptv,金山毒霸清除了也不管用, 卸载了pptv过一会又自动安装上了,太嚣张了哈。 ## 监控进程跟目录变化 接下来使用 ProcessMonitor 监控进程,下载地址 https://docs.microsoft.com/zh-cn/sysinternals/downloads/procmon#download DirectoryMonitor监
分情况 /************************************************************** Problem: 1084 User: lxy8584099 Language: C++ Result: Accepted Time:84 ms Memory:2004 kb********************************************************