codeforces #326 div 2 A. Duff and Meat(水)
2015-10-22 20:17
489 查看
A. Duff and Meat
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Duff is addicted to meat! Malek wants to keep her happy for n days. In order to be happy in i-th day, she needs to eat exactly ai kilograms of meat.
View Code
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Duff is addicted to meat! Malek wants to keep her happy for n days. In order to be happy in i-th day, she needs to eat exactly ai kilograms of meat.
/************************************************************************* > File Name: code/cf/#326/A.cpp > Author: 111qqz > Email: rkz2013@126.com > Created Time: 2015年10月22日 星期四 20时00分33秒 ************************************************************************/ #include<iostream> #include<iomanip> #include<cstdio> #include<algorithm> #include<cmath> #include<cstring> #include<string> #include<map> #include<set> #include<queue> #include<vector> #include<stack> #include<cctype> #define yn hez111qqz #define j1 cute111qqz #define ms(a,x) memset(a,x,sizeof(a)) using namespace std; const int dx4[4]={1,0,0,-1}; const int dy4[4]={0,-1,1,0}; typedef long long LL; typedef double DB; const int inf = 0x3f3f3f3f; const int N=1E5+7; int n; int a ,p ; int main() { #ifndef ONLINE_JUDGE freopen("in.txt","r",stdin); #endif scanf("%d",&n); for ( int i = 0 ; i < n ; i++) scanf("%d %d",&a[i],&p[i]); int mi = inf; int ans = 0 ; for ( int i = 0 ; i < n ; i++) { if (p[i]<mi) mi = p[i]; ans += mi*a[i]; } cout<<ans<<endl; #ifndef ONLINE_JUDGE fclose(stdin); #endif return 0; }
View Code
相关文章推荐
- 状态压缩 + 暴力 HDOJ 4770 Lights Against Dudely
- 利用51单片机 串口通信实现字符串发送
- 年月日地址
- FMDB取出所有数据
- java使用正则表达式过滤掉字符串中的html标签
- Eclipse 中报Unhandled event loop exception Java heap space(如果是JS导致的)解决方案
- HDU - 2955 Robberies 01背包
- 控制器的创建方式
- Arrays
- js 函数的方法 函数调用模式 this => that arguments
- Spring MVC 静态资源的访问
- 优秀Python学习资源收集汇总
- 指针学习笔记(1)——运算符*
- centos7 在NAT环境下搭建vsftp
- iPhone屏幕尺寸、分辨率及适配
- 访问word Error #2044: 未处理的 IOErrorEvent:. text=Error #2038: 文件 I/O 错误. (服务器处理方案)
- iOS NSThread
- 在win7下的简单的备份python脚本
- HDU1284 钱币兑换问题
- poj 1979 Red and Black 【dfs(模板)】