Codeforces 667A Pouring Rain 667B Coat of Anticubism
2016-04-30 20:57
435 查看
A题列个方程就解决了。
B题就是两边之和大于第三边,一下就搞定了
A,B都是很简单的应该,,用文件交题A和B的时候,代码复制错了,WA了几次。。。。。
#include <cstdio> #include <iostream> #include <cstring> #include <algorithm> #include <cmath> #include <vector> #include <queue> using namespace std; typedef long long ll; #define pi 3.14159265359 inline void file() { freopen("D:\\go.txt", "r", stdin); freopen("D:\\leave.txt", "w", stdout); } int main() { //file(); //ios::sync_with_stdio(false); double d, h, v, e; scanf("%lf%lf%lf%lf", &d, &h, &v, &e); if ((pi * (d / 2) * (d / 2) * e >= v)) printf("NO\n"); else { double tmp1 = pi * (d / 2) * (d / 2) * h; double tmp = pi * (d / 2) * (d / 2) * e; printf("YES\n%.12f\n", tmp1 / (v - tmp)); } return 0; }
B题就是两边之和大于第三边,一下就搞定了
#include <cstdio> #include <iostream> #include <cstring> #include <algorithm> #include <cmath> #include <vector> #include <queue> using namespace std; typedef __int64 ll; #define pi 3.14159265359 const int MAX = 1e5 + 5; typedef long long ll; ll arr[MAX]; inline void file() { freopen("D:\\go.txt", "r", stdin); freopen("D:\\leave.txt", "w", stdout); } int main() { //file(); //ios::sync_with_stdio(false); int n; scanf("%d", &n); ll res = 0; for (int i = 0; i < n; ++i) { scanf("%I64d", &arr[i]); res += arr[i]; } ll a = res / 3; sort(arr , arr + n); ll t1 = 0; for (int i = n - 1; i >= 0; --i) { t1 += arr[i]; if (t1 >= a) break; } ll tmp = res - t1; printf("%I64d\n", abs(tmp - t1) + 1); return 0; }
A,B都是很简单的应该,,用文件交题A和B的时候,代码复制错了,WA了几次。。。。。
相关文章推荐
- vc 6.0 中 error LNK2001: unresolved external symbol _main和fatal error LNK1120: 1 unresolved externals
- 免费邮件服务器:MailEnable
- LightOJ - 1236 Pairs Forming LCM 合数分解
- Codeforces Round #349 (Div. 2)-A. Pouring Rain(数学)
- ORA-01501: CREATE DATABASE failed
- Attended two wedding in the weekend
- Usage: gij [OPTION] ... CLASS [ARGS] ... to invoke CLASS.main, or
- HDU 1039 -Easier Done Than Said?
- 人工智能
- Light oj Trailing Zeroes (III) (二分查找)
- [LintCode] Paint House 粉刷房子
- [LintCode] Paint House II 粉刷房子之二
- Aizu 0121 Seven Puzzle
- 绘图室(PaintOffice)
- SVN提交时Commit Failed的解决方案
- Aizu 0558
- 设计模式(十二)职责链模式(Chain of Responsibility)(对象行为型)
- 设计模式(十二)职责链模式(Chain of Responsibility)(对象行为型)
- wait_event_interruptible() 分析
- LightOJ 1076 Get the Containers(二分经典)