UVA10071(重温高中物理公式)

Back to High School Physics

Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu

题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18809

Description


A particle has initial velocity and constant acceleration. If its velocity after certain time is v then what will its displacement be in twice of that time?

Input
The input will contain two integers in each line. Each line makes one set of input. These two integers denote the value of v (-100 <= v <= 100) and t(0<=t<= 200) ( t means at the time the particle gains that velocity)

Output
For each line of input print a single integer in one line denoting the displacement in double of that time.

Sample Input
0 0
5 12

Sample Output
0

120



解题思路:

题目大意就是给你一个路程中间点的速度和到达该点的时间,问经过2倍的时间,从最出发点发生的总位移是多少。

裸高中物理公式·····首先用时间中点的平均速度 = 该过程的平均速度 = v = (v0 + v)  / 2,得出v0 = v 。用平均速度乘时间的位移公式x1 = (v0 + v) / 2,求出第一段位移x1。接下来用v^2 - v0 ^ 2 = a *a *x,求出加速度a。最后用连续相等时间间隔位移差公式x2 - x1 = a * t ^ 2,求出对应的第二段位移x2。输出x1 + x2即可。


完整代码:

#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <climits>
#include <cassert>
#include <complex>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;

#pragma comment(linker, "/STACK:102400000,102400000")

typedef long long LL;
typedef double DB;
typedef unsigned uint;
typedef unsigned long long uLL;

/** Constant List .. **/ //{

const int MOD = int(1e9)+7;
const int INF = 0x3f3f3f3f;
const LL INFF = 0x3f3f3f3f3f3f3f3fLL;
const DB EPS = 1e-9;
const DB OO = 1e20;
const DB PI = acos(-1.0); //M_PI;

int main()
{
    #ifdef DoubleQ
    freopen("in.txt","r",stdin);
    #endif
    int a , b;
    while(cin >> a>> b)
    {
        int v0 = a;
        int x1 =( (a + v0) * b ) / 2;
        int aa = (a * a - v0 * v0) / (2 * x1);
        int x2 = aa * b * b + x1;
        cout << x1 + x2 << endl;
    }
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值