杭电2019 数列有序!(STL解法)】的更多相关文章

由于这题对于学过数据结构的我来说,真的是很简单,为了减少时间上的损失,链表无疑是最好的选择(因为数组要往后移位子).然后,因为最近想玩些STL的骚操作,所以就用<list>了,然后顺便学了下迭代器的用法,其原理其实和指针差不多,就是比指针安全.然后,在a题的过程中发现指针的+—还是有些问题的,所以,就用数值代替了.闲话不多说,奉上ac代码: #include <iostream> #include<math.h> #include <iomanip> #in…
数列有序! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 122510    Accepted Submission(s): 50550 Problem Description 有n(n<=100)个整数,已经按照从小到大顺序排列好,现在另外给一个整数x,请将该数插入到序列中,并使新的序列仍然有序.   Input 输入数据包含多个测试…
数列有序! Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 2   Accepted Submission(s) : 1 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description 有n(n<=100)个整数,已经按照从小到大顺序排列好,现在另外给…
Time Limit: 1000 MS Memory Limit: 32768 KB 64-bit integer IO format: %I64d , %I64u   Java class name: Main [Submit] [Status] [Discuss] Description 有n(n<=100)个整数,已经按照从小到大顺序排列好,现在另外给一个整数x,请将该数插入到序列中,并使新的序列仍然有序. Input 输入数据包含多个测试实例,每组数据由两行组成,第一行是n和m,第二行是…
求数列的和 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 114175    Accepted Submission(s): 68118 Problem Description 数列的定义如下:数列的第一项为n,以后各项为前一项的平方根,求数列的前m项的和.   Input 输入数据有多组,每组占一行,由两个整数n(n<10000)和m…
#include<vector> #include<iostream> #include<algorithm> #include<cstdio> using namespace std; bool cmp(int a, int b) { return a < b; } bool cmp2(int a, int b) { return a > b; } int main() { int n, m; && m != )) { vect…
题意 给定 $d,x$,$f(d,k)$ 表示 $1 \sim k$ 中 $d$ 出现的次数, $k$ 满足 $f(d,k) = k$,求小于 $x$ 的最大的 $k$. 分析 正解不会...,学习了oeis大法. 打表得到前几个数字,然后取oeis上找完整的. 之所以能这么做,是因为 $k$ 只有有限个.其中最大是 $d=8$,也只有344个 (oeis A130430). #include <bits/stdc++.h> using namespace std; typedef long…
题目描述 Tom has a string containing only lowercase letters. He wants to choose a subsequence of the string whose length is k and lexicographical order is the smallest. It's simple and he solved it with ease.But Jerry, who likes to play with Tom, tells h…
2010. 水仙花数 问题描述 Problem Description 春天是鲜花的季节,水仙花就是其中最迷人的代表,数学上有个水仙花数,他是这样定义的: "水仙花数"是指一个三位数,它的各位数字的立方和等于其本身,比如:153=1^3+5^3+3^3. 现在要求输出所有在m和n范围内的水仙花数. Input 输入数据有多组,每组占一行,包括两个整数m和n(100<=m<=n<=999). Output 对于每个测试实例,要求输出所有在给定范围内的水仙花数,就是说,输…
2012  素数判定 #include <stdio.h> #include <math.h> int main() { int x,y,i,j,a,flag; while(scanf("%d %d",&x,&y)!=EOF){ flag = ; &&y==){break;} for(i=x;i<=y;i++){ a = i*i+i+; ;j<a/;j++){ ){flag++;break;} } ){break;}…