#include<iostream> using namespace std; int main(){ double a,b,c,f0,f1,f2,f3,f4,f5; while(scanf("%lf%lf%lf",&f0,&f1,&f2)==3){ c = f0; a = (f2-2*f1+f0)/2.0; b = f1-f0-a; f3 = 9*a+3*b+c;
本来这是道水题 结果写了一遍卡了十分钟,逻辑问题。 本该放弃这个方法的,仍不死心,于是乎想到了过河拆桥这招 #include<stdio.h> int main() { int m,n,i,j,k = 0,count = 0,a[1001],b[1001]; scanf("%d %d",&n,&m); for(i = 0;i<n;i++) scanf("%d",&a[i]); for(i = 0;i<m;i+
描述 有n(n<=100)个整数,已经按照从小到大顺序排列好,现在另外给一个整数m,请将该数插入到序列中,并使新的序列仍然有序。 输入 输入数据包含多个测试实例,每组数据由两行组成,第一行是n和m,第二行是已经有序的n个数的数列。n和m同时为0标示输入数据的结束,本行不做处理。 输出 对于每
#include<iostream> using namespace std; int main(){ long long n,k,i,j,ans; while(scanf("%lld%lld",&n,&k)==2&&n){ if(n-k<k){ k = n-k; } ans = 1; for(i=1,j=n;i<=k;i++,
#include<iostream> using namespace std; int main(){ int a,b,n,c,d; scanf("%d",&n); while(n--){ scanf("%d%d",&a,&b); if((a+b)%2==1||a<b){ printf("impossible\n");
#include<iostream> #include<cstring> using namespace std; int main(){ char a[100005],b[100005]; int i,j,len_a,len_b; while(scanf("%s%s",a,b)==2){ len_a = strlen(a); len_b = strlen(b); j = 0;
#include<iostream> using namespace std; int main(){ int cnt,i,data[105]; double ans[105]; cnt = 0; while(scanf("%d",&data[cnt])==1){ ans[cnt] = 0; for(i=1;i<=data[cnt];i++){ ans[cnt] += 0.
#include<iostream> using namespace std; int main(){ int n,a,b; scanf("%d",&n); while(n--){ scanf("%d%d",&a,&b); if(a==b){ if(a%2==0){ printf("%d\n",a*
#include<iostream> #include<cmath> #include<cstring> using namespace std; int main(){ int sum,mile; char a[2][20],icon[2]; while(true){ sum = 0; while(true){ scanf("%s",a[0]);
传送门 题意 给定一棵 \(n\) 个点的有根树。初始有 \(2\) 个人在根结点。每 \(1\) 秒内,每个人要么走向某个儿子,要么停在原地不动。当两人都在某个结点上时,其中一人可以立即传送到另一个人的位置上。最后要求每个结点都被至少经过一次,问总共花费的最小时间。 \(n \le 5\times10^6\)
#include<iostream> #include<algorithm> #include<cmath> using namespace std; int cmp(int a,int b){ return abs(a)<abs(b); } int main(){ int i,t,n,data[50005]; scanf("%d%d",&t,&n); for(i=0;i<n;i++){
正题 题目链接:https://uoj.ac/problem/84 题目大意 有\(n\)个点的一棵树,\(1\)为根,两个人从根节点往下走(只能从深度小的点走到深度大的点)。 两个人每一秒都可以一条边(也可以不移动),或者不消耗时间将一个人传送到另一个人那里。 求遍历整棵树需要的最少时间。 \(1\leq n\leq 5\time
#include<iostream> #include<cstring> using namespace std; int main(){ char irr[25][2][25],tgt[25],vowel[]={'a','e','i','o','u'},tail[]={'o','s','x'},tails[][5]
#include<iostream> #include<cstring> using namespace std; int main(){ char dict[10005][20],tar[20],tmp[20]; int count,i,j,diff_num; bool flag; count = 0; while(scanf("%s",tmp)==1&&strcmp(tmp,"#")
#include<iostream> #include<cctype> #include<cstring> #include<string> using namespace std; int main(){ char a[][5] = {".-","-...","-.-.","-..",".","..-.","--.&qu
#include<iostream> using namespace std; int main(){ int n; int x,y,z,data[10]; char name[10][10]; int maxv,minv,maxi,mini; while(scanf("%d",&n)==1&&n!=-1){ maxv = -1; minv = 9999; for
Jisoo 大家都知道,对于两个数 \(a,b\)的\(lcm\),只要求去每个质数因数的较大的幂乘起来就行了。然后卡卡时 #include<cstdio> #include<iostream> #include<cstring> #include<iomanip> #include<cmath> #include<stack> #include<algorithm> #include<bitset>
题目 题意: 给定n个数,每个数具有B或者R属性之一。B表示该数可以执行任意次-1,R表示该数可以执行任意次+1。判断这n个数能否凑出一个permutation。 思路: 我直接线段树维护,发现没过样例,确实越来越菜了。 冷静分析,可以把b和r属性的数分别维护,进行排序。 之后按照数值now从小到大
题目来源:Problem - A - CodeforcesCodeforces. Programming competitions and contests, programming communityhttps://codeforces.com/contest/1602/problem/A 题干: 第一道水题,结果被想复杂了。这个只需要将字符串进行排序,然后输出一个最小元素和一个缺少最小元素的字串即
给出一个完全图唯一最小生成树,求完全图所有边权的和 考场想到n^2log的计算,枚举两点再求出两点路上最长边再判断要不要+1.没想到就是个kruskal水题 const int N = 23007; struct edge { int x, y, z; bool operator <(const edge&rhs) const { return z < rhs.z; } } t[N]; in
[https://www.luogu.com.cn/problem/P1310]([NOIP2011 普及组] 表达式的值) 神仙题, 被吊着打qaq 这不就是一个求表达式树的后序遍历吗. \(—zwd\) 水题。 水题。 虐了我两次。 qaq 然后就开始了表达式的恶补 首先是把表达式转成后缀表达式 因为好求 转的方法: 如果有数字
1 成功上传拿到上传地址,尝试修改后缀名 没有阻拦的绕了过去,直接上蚁剑吧 翻了一圈没找到flag,找到了数据库数据连接看看 不断点击数据库发现了藏着flag的地方 点击之后没有直接出现flag,而是要执行SQL语句将flag读取出来 2 莫不是签到题,直接传php文件吧 上传之后没
https://blog.csdn.net/m0_61067261/article/details/120585478?spm=1001.2014.3001.5501https://blog.csdn.net/m0_61067261/article/details/120585478?spm=1001.2014.3001.5501 672. 税(acwing水题记)_m0_61067261的博客-CSDN博客读取一个保留两位小数的浮点数值,表示一个公民的
字符串水题 题目链接:luogu U138101 题目大意 给你一个大字符串,然后每次给你一个小字符串和 l,r,问你有多少个小字符串的子串满足它是大字符串的子串,而且它每个字符作为数字之和在 l~r 之间。 (保证字符串都是由数字构成) 思路 首先不难看出首先可以 SAM 或者 SA(这个要把所有字符串拼
没啥好说的又写了一次的水题。 #include <bits/stdc++.h> using namespace std; int main(){ string str; cin >> str; map<char, int> ans; for(auto s: str) ans[s]++; for(auto a: ans) cout << a.first << ":" << a.second <