UVA 10905(为什么)
来源:互联网 发布:mysql读写分离实现 编辑:程序博客网 时间:2024/06/07 08:09
自定义比较函数就可简单解决。刚开始的时候有一个小问题就一直run time error,后来改了之后就过了,不明白为什么。希望路过的大神赐教。
/****author :Skylon **╭︿︿︿╮{/ A C /} ( (OO) ) ︶︶︶ ** **** 题**** 2014 年 月 日****/#include <cmath>#include <queue>#include <stack>#include <vector>#include <cstdio>#include <string>#include <cctype>#include <climits>#include <cstring>#include <cstdlib>#include <iostream>#include <algorithm>using namespace std;string ch[60];bool cmp (string a,string b){ return a+b>b+a;}int main(){ int n; while (scanf("%d",&n),n) { for (int i=1;i<=n;i++)//原来写的是 for (int i=0;i<n;i++) { cin>>ch[i]; } sort(ch+1,ch+n+1,cmp); for (string::size_type i=1;i<=n;i++)//原来写的是 for (string::size_type i=0;i<n;i++) { cout<<ch[i]; } cout<<endl; } return 0;}原来写的0到n的循环,一直run time error。改了之后就过了,还没弄明白。。
0 0
- UVA 10905(为什么)
- uva 11383 Golden Tiger Claw km模版题 但为什么Wa了呀? (KM)
- Transportation uva 301 为什么错了?
- uva 10905
- uva 10905
- uva----10905
- UVa 10905
- UVa 10905
- uva 10905
- uva 445 uva 489 uva 490 uva 694(模拟)
- uva 10905 Children's Game (排序)
- (intermediate) UVA 10905 - Children's Game
- UVa 10905 Children's Game ( 贪心 )
- uva-10905Children's Game(贪心)
- UVA - 10905 Children's Game(贪心)
- uva 10905 题解(贪心水题)
- UVA 10905 Children's Game (贪心)
- UVa 10905 Children's Game (贪心)
- POJ 1201 Intervals
- Java中“this”的理解
- 给eclipse安装插件
- Java 生成本文文件的时候,Dos格式转成Unix格式
- SQL优化大总结
- UVA 10905(为什么)
- (34)DOM应用之搜索表格中的内容(多关键字搜索)
- 发大幅度会飞的
- 数据库资料网站备份
- leedcode做题总结,题目Gas Station-------- 2013/09/28
- POJ 1028
- extjs使用AJAX调用方法结束不给返回值赋值问题解决
- gcc和arm-linux-gcc区别
- Setting up a CloudStack dev environment on Windows