K - Kindergarten Physics
https://vjudge.net/contest/386568#problem/K
There are two balls that weigh aa kg and bb kg respectively. They can be regarded as particles in this problem, as they are small enough. At the very beginning (i.e. t=0t=0), the distance between two balls is dd km, and both of them are not moving.
Assuming that only gravitation works in this system (no other objects or other forces considered). The two balls has started moving since t=0t=0. Your task is to calculate the distance between them when t=t0t=t0 (s).
Help Zhang3 solve the problem!
The following information might help when solving the problem.
- Universal gravitation formula: F=G⋅m1⋅m2/r2F=G⋅m1⋅m2/r2
- Gravitational constant: G=6.67430×10−11m3/(kg⋅s2)G=6.67430×10−11m3/(kg⋅s2)
InputThe first line of the input gives the number of test cases T(1≤T≤100)T(1≤T≤100). TT test cases follow.
For each test case, the only line contains four integers a,b,d,t0(1≤a,b,d,t0≤100)a,b,d,t0(1≤a,b,d,t0≤100), representing the mass of the two balls, the initial distance between them, and how much time the balls move.
It is guaranteed that two balls will not collide within (t0+1)(t0+1) seconds.
OutputFor each test case, print a line with a real number xx, representing that the distance is xx km.
Your answers should have absolute or relative errors of at most 10−610−6.
Sample Input
3
1 2 3 4
7 73 7 68
100 100 1 100
Sample Output
2.99999999999999999982
6.99999999999999974807
0.99999999999993325700
水题:只受万有引力 影响极小 不足精度
代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<deque>
#include<iomanip>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include <vector>
#include <iterator>
#include <utility>
#include <sstream>
#include <limits>
#include <numeric>
#include <functional>
using namespace std;
#define gc getchar()
#define mem(a) memset(a,0,sizeof(a))
//#define sort(a,n,int) sort(a,a+n,less<int>()) #define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef char ch;
typedef double db; const double PI=acos(-1.0);
const double eps=1e-6;
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
const int maxm=100+10;
const int N=2e5+10;
const int mod=1e9+7; int main()
{
int T = 0;
int a = 0 , b = 0 , d = 0 , t = 0;
cin >> T;
while(T--)
{ cin >> a >> b >> d >> t;
cout<< d <<endl;
}
return 0;
}
K - Kindergarten Physics的更多相关文章
- 2012-2014 三年浙江 acm 省赛 题目 分类
The 9th Zhejiang Provincial Collegiate Programming Contest A Taxi Fare 25.57% (166/649) (水 ...
- ACM第一阶段学习内容
一.知识目录 字符串处理 ................................................................. 3 1.KMP 算法 .......... ...
- django模型操作
Django-Model操作数据库(增删改查.连表结构) 一.数据库操作 1.创建model表
- poj 3692 Kindergarten (最大独立集)
Kindergarten Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 4903 Accepted: 2387 Desc ...
- HDU 5826 physics(物理)
physics(物理) Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) D ...
- HDU 5826 physics (积分推导)
physics 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5826 Description There are n balls on a smoo ...
- [POJ3684]Physics Experiment
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1363 Accepted: 476 Special Judge ...
- poj 3684 Physics Experiment(数学,物理)
Description Simon ), the first ball is released and falls down due to the gravity. After that, the b ...
- POJ 3692:Kindergarten(最大的使命)
id=3692">Kindergarten Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 4920 Ac ...
- Beginning Math and Physics For Game Programmers (Wendy Stahler 著)
Chapter 1. Points and Lines (已看) Chapter 2. Geometry Snippets (已看) Chapter 3. Trigonometry Snippets ...
随机推荐
- 第二次阶段性OOP题目集总结性Blog
前言: 基础题目训练说明 第一次基础题目有两道,题量较少,通过对之前题目的进一步扩展,考察知识点主要是1.类的封装.继承.多态2.抽象类3.接口.题目主要考查了学生对代码结构和可扩展性优化的能力.难度 ...
- 前n项结尾0的个数
题目链接:K-卡特兰数_2023河南萌新联赛第(二)场:河南工业大学 (nowcoder.com) 一开始想到和阶乘末尾0的个数一样的题目,但有点不同,根据公式,一开始的重点完全在公式上了,因为前几项 ...
- odoo14里面给所有模型添加方法
给所有的model都添加一个方法, 即所有的model都能调用[类似于create.write.unlink.read]. 方式一: from odoo import api, fields, mod ...
- shell脚本中循环的变量无法全局生效
说明 我们在编写shell脚本时,发现shell脚本中定义的while循环中定义的变量无法作用于全局,这是因为我们使用while循环时,创建了subshell,当subshell退出后,变量值就回收了 ...
- 致谢每一位ChunJun Contributor!这里有一份礼物等你领取!
作为一个批流统一的数据集成框架,秉承着易用.稳定.高效的目标,ChunJun于2018年4月29日在Github上将内核源码正式开放. 从还被叫作FlinkX,写下第一行代码开始,ChunJun已经走 ...
- hot100之回溯上
全排列(046) class Solution { List<List<Integer>> res = new ArrayList<>(); public List ...
- SQL 语句生成MD5值
https://blog.csdn.net/BowenXu11/article/details/104627263 select substring(sys.fn_sqlvarbasetostr(Ha ...
- SQL Server 游标写入数据
https://www.cnblogs.com/wanghonghu/p/4093411.html set identity_insert 表名 ON --允许对自增列Id插入指定数据 insert ...
- Sql server 左连接查询最大记录
SELECT * FROM Billcode_in a LEFT JOIN Billcode_place b ON a.billcode=b.billcode AND b.id=(SELECT MAX ...
- 可配置Modbus网关 嵌入式设备联网解决方案
1.概述 可配置Modbus网关可以预先配置Modbus RTU端的设备的地址.功能码和寄存器列表,并存储到网关内部.网关会自动采集这些配置的RTU设备的数据,然后映射到连续的Modbus TCP ...