【瞎搞】 HDU 5122 K.Bro Sorting
来源:互联网 发布:java log日志输出 编辑:程序博客网 时间:2024/06/11 21:52
点击打开链接
思路:对于每一个数只要后面的数有比它小就要换
所以逆着计算下就可以了。。(同时记录最小值)
#include <cstdio>#include <cstring>#include <cstdlib>#include <string>#include <iostream>#include <algorithm>#include <sstream>#include <cmath>using namespace std;#include <queue>#include <stack>#include <set>#include <vector>#include <deque>#include <map>#define cler(arr, val) memset(arr, val, sizeof(arr))#pragma comment(linker, "/STACK:102400000,102400000")typedef long long LL;const int MAXN = 230+1;const int MAXM = 140000;const int INF = 0x3f3f3f3f;const int mod = 1000000007;int a[10000100];int main(){#ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout);#endif int t,n,cas=1; cin>>t; while(t--) { cin>>n; for(int i=0;i<n;i++) scanf("%d",&a[i]); int maxx=999999999,sum=0; for(int i=n-1;i>=0;i--) { if(maxx<a[i]) sum++; else maxx=a[i]; } printf("Case #%d: ",cas++); cout<<sum<<endl; }}
0 0
- 【瞎搞】 HDU 5122 K.Bro Sorting
- hdu 5122 K.Bro Sorting
- hdu 5122 K.Bro Sorting
- HDU 5122 K.Bro Sorting
- hdu 5122 K.Bro Sorting
- HDU-5122-K.Bro Sorting
- HDU 5122 K.Bro Sorting
- HDU 5122 K.Bro Sorting
- HDU 5122 K.Bro Sorting
- HDU 5122 K.Bro Sorting
- HDU 5122 K.Bro Sorting
- HDU 5122 K.Bro Sorting
- HDU 5122 K.Bro Sorting
- K.Bro Sorting HDU
- HDU-5122 K.Bro Sorting(贪心)
- HDU 5122 K.Bro Sorting (贪心)
- HDU - 5122 K.Bro Sorting(贪心)
- hdu 5122 K.Bro Sorting(单调栈)
- 使用Nginx负载均衡搭建高性能.NETweb应用程序一
- ubuntu安装和卸载软件命令
- 动态生成N维二维数组,并输出到文件中
- Windows的消息机制
- Android中级教程之 Android应用程序的生命周期
- 【瞎搞】 HDU 5122 K.Bro Sorting
- 第十四周实践代码
- Exporting Attachments
- 如何方便的下载旧版本的JDK
- MySQL优化1:数据库设计优化
- 如何正确地将PVID从ASM磁盘头部除去
- [iOS_Dev] Win平台 搭建 iOS开发环境 ---- 使用VMWare虚拟机
- 第十四周项目1-折腾二维数组
- ListView的基本使用与优化