题目链接 题意 : 刚上高一的森森为了学好物理,买了一个“非常弹”的球.虽然说是非常弹的球,其实也就是一般的弹力球而已.森森玩了一会儿弹力球后突然想到,假如他在地上用力弹球,球最远能弹到多远去呢?他不太会,你能帮他解决吗?当然为了刚学习物理的森森,我们对环境做一些简化: 假设森森是一个质点,以森森为原点设立坐标轴,则森森位于(0, 0)点. 小球质量为w/100 千克(kg),重力加速度为9.8米/秒平方(m/s2). 森森在地上用力弹球的过程可简化为球从(0, 0)点以某个森森选择的角度ang…
题目链接 https://www.patest.cn/contests/gplt/L3-013 思路 将速度 分解成 竖直方程 和 垂直方向 当 角度为 45° 时 射出的时候 水平方向 最远 所以 可以将 竖直方向的速度 和 垂直方向的速度是一样的 然后 每次循环 算出 速度和时间 更新答案 然后 界定一个 阈值 跳出 就可以 AC代码 #include <cstdio> #include <cstring> #include <ctype.h> #include &…
题目链接 分析 : 就是一个 0/1 背包,但是需要记录具体状态的转移情况 这个可以想象成一个状态转移图,然后实际就是记录路径 将状态看成点然后转移看成边,最后输出字典序最小的路径 这里有一个很巧妙的做法 先将所有的硬币升序排序(这一点很重要) 然后在这一条件下,假设当前状态是考虑第 i 个硬币,前一个状态是考虑第 i-1 个硬币 试想对于同一个体积,如果选用的硬币数量越多是不是字典序更小 然后对于如果对于同一体积下,选用硬币数一样多的两种方案 由于我们已经升序排序,如果有一样多硬币的情况,那么…
题目链接 题意 : 有 n 个球队,给出主客场胜负图,找出一个序列 1.2.3..... 使得 1 战胜过 2 .2 战胜过 3.3 战胜过 4..... n 战胜过 1 ( 这个序列是 1~n 的其中一个全排列 ) 分析 : n 最大就只有 20 ,明摆着让你搜,但是这题我失了志啊,下面说几个搜索要注意的点 ① 因为能构成环,所以答案序列肯定是从 1 开始 ② 搜索时候如果接下来没有一个点是能够战胜 1 的那么则不继续搜 ( 没有这个剪枝会被第四个点卡住 ) ③ 题目给出的图是不对称的,而且要…
题目链接 题意 : 中文题请点链接,挺复杂的... 分析 : 乍一看是个最短路,实际就真的是个最短路.如果没有 “ 在有多条最短路径的时候输出换乘次数最少的” 这一条件的约束,那么这题就是直接建图然后跑个 Dij 就行了,那有了这个约束条件还是要大胆的向最短路思路靠,题目既然需要换乘次数少的,那么我们在进行最短路松弛操作的时候,面对松弛过后最短路径相等的情况就要分开讨论,这时候为了方法取最优值,需要多记录一个信息 ==> 跑到当前点时候换乘次数是多少次,开个数组来记录就行了,其他的还是按最短路来…
题意: 刚上高一的森森为了学好物理,买了一个“非常弹”的球.虽然说是非常弹的球,其实也就是一般的弹力球而已.森森玩了一会儿弹力球后突然想到,假如他在地上用力弹球,球最远能弹到多远去呢?他不太会,你能帮他解决吗?当然为了刚学习物理的森森,我们对环境做一些简化: 假设森森是一个质点,以森森为原点设立坐标轴,则森森位于(0, 0)点. 小球质量为w/100 千克(kg),重力加速度为9.8米/秒平方(m/s2). 森森在地上用力弹球的过程可简化为球从(0, 0)点以某个森森选择的角度ang (0 <…
L3-013. 非常弹的球 时间限制 100 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 俞勇(上海交通大学) 刚上高一的森森为了学好物理,买了一个"非常弹"的球.虽然说是非常弹的球,其实也就是一般的弹力球而已.森森玩了一会儿弹力球后突然想到,假如他在地上用力弹球,球最远能弹到多远去呢?他不太会,你能帮他解决吗?当然为了刚学习物理的森森,我们对环境做一些简化: 假设森森是一个质点,以森森为原点设立坐标轴,则森森位于(0, 0)点. 小…
刚上高一的森森为了学好物理,买了一个“非常弹”的球.虽然说是非常弹的球,其实也就是一般的弹力球而已.森森玩了一会儿弹力球后突然想到,假如他在地上用力弹球,球最远能弹到多远去呢?他不太会,你能帮他解决吗?当然为了刚学习物理的森森,我们对环境做一些简化: 假设森森是一个质点,以森森为原点设立坐标轴,则森森位于(0, 0)点. 小球质量为/ 千克(kg),重力加速度为9.8米/秒平方(/). 森森在地上用力弹球的过程可简化为球从(0, 0)点以某个森森选择的角度ang (0) 向第一象限抛出,抛出时假…
此案例基于拖曳和弹动球两个技术功能实现,如有不懂的可以参考之前的相关文章,属于递进式教程. 五环弹动球 好吧,名字是我起的,其实,你可以任意个球进行联动弹动,效果还是很不错的,有很多前端都是基于这个特效,可以搞出一些很有科技感的效果出来. Wpf 和 SkiaSharp 新建一个WPF项目,然后,Nuget包即可 要添加Nuget包 Install-Package SkiaSharp.Views.WPF -Version 2.88.0 其中核心逻辑是这部分,会以我设置的60FPS来刷新当前的画板…
pat链接:http://pat.zju.edu.cn 1 #include<stdio.h> 2 int main(){ 3 int a,b; 4 int c; 5 while(scanf("%d %d",&a,&b)!=EOF){ 6 c=a+b; 7 if(c<0){ 8 c=-c; 9 printf("-"); 10 } 11 if(c>=1000000) 12 printf("%d,%03d,%03d\n&…
1035. Password (20) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is…
1025. PAT Ranking (25) 时间限制 200 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneous…
1001. 害死人不偿命的(3n+1)猜想 1002. 写出这个数 1003. 我要通过! 1004. 成绩排名 1005. 继续(3n+1)猜想 1006. 换个格式输出整数 1007. 素数对猜想 1008. 数组元素循环右移问题 1009. 说反话 1010. 一元多项式求导 1011. A+B和C 1012. 数字分类 1013. 数素数 1014. 福尔摩斯的约会 1015. 德才论 1016. 部分A+B 1017. A除以B 1018. 锤子剪刀布 1019. 数字黑洞 1020.…
1021: #include<stdio.h> #include<string.h> #include<vector> #include<queue> using namespace std; #define N 10005 vector<int> v[N]; queue<int> q; int tree[N],h[N],dis[N],vis[N]; int n,maxh; int findroot(int x){ ) return…
#include<stdio.h> #include<string.h> int main(){ ]; ]; ]; ]; ]; int i; float sum; memset(w,,sizeof(w)); memset(t,,sizeof(w)); memset(l,,sizeof(w)); ;i<;i++){ scanf("%f %f %f",&w[i],&t[i],&l[i]); } ;i<;i++){ //x[i]=m…
#include <stdio.h> #include <iostream> #include <algorithm> #include <math.h> #include <string.h> #include <queue> #include <stack> #define N 400 #define ll int using namespace std; struct node{  ll gold,all,pre,n…
1012. The Best Rank (25) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematic…
1003. Emergency (25) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount…
1038. Recover the Smallest Number (30) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given {32, 321, 3214, 0229, 87},…
1047. Student List for Course (25) 时间限制 400 ms 内存限制 64000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Zhejiang University has 40000 students and provides 2500 courses. Now given the registered course list of each student, you are supposed to output…
1054. The Dominant Color (20) 时间限制 100 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the larges…
1059. Prime Factors (25) 时间限制 50 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 HE, Qinming Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1^k1 * p2^k2 *…*pm^km. Input Specificatio…
1023. Have Fun with Numbers (20) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913…
1024. Palindromic Number (25) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number.…
1061. Dating (20) 时间限制 50 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Sherlock Holmes received a note with some strange strings: "Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm". It took him only a minut…
1037. Magic Coupon (25) 时间限制 100 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a product, you m…
1031. Hello World for U (20) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given any string of N (>=5) characters, you are asked to form the characters into the shape of U. For example, "helloworld" can be printed as: h…
1029. Median (25) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1={11, 12, 13, 14} is 12, and the median…
1048. Find Coins (25) 时间限制 50 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept a…
Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1 <= i <= j <= K. The Maximum Subsequence is the continuous subsequence which has the largest sum of its elements. For examp…