Table of Contents
Physics Experiment poj 3684 弹性碰撞
Home Backend Development PHP Tutorial Physics Experiment poj 3684 Elastic Collision_PHP Tutorial

Physics Experiment poj 3684 Elastic Collision_PHP Tutorial

Jul 13, 2016 am 10:05 AM
elasticity

Physics Experiment poj 3684 弹性碰撞

Language: Physics Experiment
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 1107   Accepted: 380   Special Judge

Description

Simon is doing a physics experiment with N identical balls with the same radius of R centimeters. Before the experiment, all N balls are fastened within a vertical tube one by one and the lowest point of the lowest ball is H meters above the ground. At beginning of the experiment, (at second 0), the first ball is released and falls down due to the gravity. After that, the balls are released one by one in every second until all balls have been released. When a ball hits the ground, it will bounce back with the same speed as it hits the ground. When two balls hit each other, they with exchange their velocities (both speed and direction).

Simon wants to know where are the N balls after T seconds. Can you help him?

In this problem, you can assume that the gravity is constant: g = 10 m/s2.

Input

The first line of the input contains one integer C (C ≤ 20) indicating the number of test cases. Each of the following lines contains four integers N, H, R, T.
1≤ N ≤ 100.
1≤ H ≤ 10000
1≤ R ≤ 100
1≤ T ≤ 10000

Output

For each test case, your program should output N real numbers indicating the height in meters of the lowest point of each ball separated by a single space in a single line. Each number should be rounded to 2 digit after the decimal point.

Sample Input

2
1 10 10 100
2 10 10 100
Copy after login

Sample Output

4.95
4.95 10.20
Copy after login

Source

POJ Founder Monthly Contest – 2008.08.31, Simon

题意:将N个半径为R的球放入一个圆桶(圆桶口径刚好放入一个球),将圆桶竖直放着,最下端距离地面H高度,让球每隔一秒自由下落,求T时刻各个球距离地面的高度。

思路:所有的球都一样可以忽视它们的碰撞,视为互相穿过继续运动。这样就可以分别单独求出每个球T时刻的高度后排序就是答案了。

#include <iostream>
#include <cstdio>
#include <cstring>
#include 
#include <cmath>
#include <string>
#include<map>
#include <stack>
#include <vector>
#include <set>
#include <queue>
#pragma comment (linker,/STACK:102400000,102400000)
#define maxn 105
#define MAXN 2005
#define mod 1000000009
#define INF 0x3f3f3f3f
#define pi acos(-1.0)
#define eps 1e-6
#define lson rt<<1,l,mid
#define rson rt<<1|1,mid+1,r
typedef long long ll;
using namespace std;

int N,T;
double H,R;
double ans[maxn];

double solve(int T)
{
    if (T<0) return H;
    double t=sqrt((2*H)/10.0);
    int k=(int)T/t;
    if (k%2)
        return H-5.0*(k*t+t-T)*(k*t+t-T);
    else
        return H-5.0*(T-k*t)*(T-k*t);
}

int main()
{
    int c;
    scanf(%d,&c);
    while (c--)
    {
        scanf(%d%lf%lf%d,&N,&H,&R,&T);
        for (int i=0;i<n;i++) 1="" 10="" 100="" 2="" for="" i="" int="" pre="" return=""><p> </p><p> </p><p> </p><p> </p><p> </p></n;i++)></queue></set></vector></stack></map></string></cmath></algorithm></cstring></cstdio></iostream>
Copy after login

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/962640.htmlTechArticlePhysics Experiment poj 3684 弹性碰撞 Language: Default Physics Experiment Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1107 Accepted: 380 Special Judge Descriptio...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Java and Kubernetes know each other well: the perfect companion for microservices Java and Kubernetes know each other well: the perfect companion for microservices Feb 29, 2024 pm 02:31 PM

Java is a popular programming language for developing distributed systems and microservices. Its rich ecosystem and powerful concurrency capabilities provide the foundation for building robust, scalable applications. Kubernetes is a container orchestration platform that manages and automates the deployment, scaling, and management of containerized applications. It simplifies the management of microservices environments by providing features such as orchestration, service discovery, and automatic failure recovery. Advantages of Java and Kubernetes: Scalability: Kubernetes allows you to scale your application easily, both in terms of horizontal and vertical scaling. Resilience: Kubernetes provides automatic failure recovery and self-healing capabilities to ensure that applications remain available when problems arise. Agility

What is a flexible production line layout? What is a flexible production line layout? Oct 17, 2023 am 10:28 AM

Flexible production line layout methods include U-shaped production line layout, ring-shaped production line layout, production line balanced layout, production line assembly line layout, production line unit layout, etc. Detailed introduction: 1. U-shaped production line layout is a common production line layout that can improve production efficiency and quality. In this layout, the production line is arranged in a U-shape, and workers complete each production link sequentially along the production line; 2. Environmental Type production line layout is an efficient production line layout method that can improve production efficiency and quality; 3. Balanced production line layout, etc.

How to implement elastic and fault-tolerant architectural patterns based on Spring Boot How to implement elastic and fault-tolerant architectural patterns based on Spring Boot Jun 23, 2023 am 09:43 AM

With the continuous expansion of system scale and the continuous improvement of business requirements, the elasticity and fault tolerance of software systems have become a crucial part of architectural design. A system with high availability, high performance, and high efficiency often needs to be elastic and fault-tolerant. Fault-tolerant design patterns. As a rapid development and deployment Java framework, SpringBoot's rich ecosystem and the framework's own design based on microservices ideas make it an ideal choice for achieving elasticity and fault tolerance. This article will introduce how to implement it based on SpringBoot

Conquer the Cloud: Java Spring Cloud Getting Started Guide to Let Your Applications Soar for Nine Days Conquer the Cloud: Java Spring Cloud Getting Started Guide to Let Your Applications Soar for Nine Days Mar 09, 2024 am 09:20 AM

In the modern era of cloud computing, building applications that are flexible, scalable, and resilient is critical. Javaspringcloud provides a powerful framework to help developers build cloud-native applications and take full advantage of the capabilities and advantages of the cloud platform. This article will serve as an introductory guide to lead you on a journey to conquer the cloud using springCloud, allowing your applications to soar to the sky. Introducing Spring Cloud Spring Cloud is a curated set of open source modules designed to simplify the development and deployment of cloud-native applications. By providing out-of-the-box components, Spring Cloud greatly reduces the complexity of building distributed, elastically scalable and fault-tolerant applications. Its modules include service development

Final Cut Pro, iMovie updated to support iPhone 15 Pro Final Cut Pro, iMovie updated to support iPhone 15 Pro Sep 21, 2023 pm 08:57 PM

The iPhone 15 Pro will be officially released on September 22 (Friday), which means that people will also start receiving the new generation iPhone on this day. Apple has begun to update its video editing-related software so that iPhone 15 Pro users can experience the convenience brought by the new video format. FinalCutPro 10.6.9 includes the following enhancements and bugfixes: • Take full advantage of the flexibility and dynamic range of record-encoded video shot with iPhone 15 Pro. • Enhanced look and feel of footage shot on popular Fujifilm, DJI and ARRI cameras using new recording profiles. •Fixed an issue that could cause Motion templates to not respond to Opacity settings

Linux server security: ensuring the flexibility of web interface applications. Linux server security: ensuring the flexibility of web interface applications. Sep 09, 2023 pm 06:13 PM

Linux server security: ensuring the flexibility of Web interface applications. With the development of Internet technology, Web interface applications play a vital role in various fields. However, due to the uncertainty of the network environment and the existence of security risks, ensuring the security of Web interface applications has become an urgent issue. As the main hosting platform for Web interface applications, the Linux server has extensive support and flexibility. We can ensure the flexibility of Web interface applications through a series of security measures. Step 1: Use firewall restrictions

How to design a flexible MySQL table structure to implement paper management functions? How to design a flexible MySQL table structure to implement paper management functions? Oct 31, 2023 am 09:33 AM

How to design a flexible MySQL table structure to implement paper management functions? Abstract: This article introduces how to design a flexible MySQL table structure to implement paper management functions. First, the paper management function is summarized and needs analyzed; secondly, the paper table, author table, journal table and relationship table are designed; finally, a basic MySQL table structure example is given. Introduction With the continuous progress of scientific research work, paper management has become one of the necessary functions for scientific researchers. As a relational database management system, MySQL can provide

An in-depth analysis of closure technology: master these principles to make your code more flexible and scalable An in-depth analysis of closure technology: master these principles to make your code more flexible and scalable Jan 13, 2024 pm 01:51 PM

Analysis of closure technology: Master this knowledge to make your code more flexible and scalable. Specific code examples are required. Introduction: In the programming world, closure (Closure) is a very powerful and flexible concept. By using closure techniques, you can make your code more resilient and scalable. This article will delve into what closures are, how they work, and how to apply closure techniques in practice. We will use specific code examples to help readers better understand and apply closures. Part 1: The Concept and Working Principles of Closures A closure refers to a

See all articles