C# ACM poj1002
排序
public static void acm1002(string[] azx)
{ string[] a = new string[azx.Length];
for (int i = ; i < azx.Length; i++)
{
StringBuilder sb = new StringBuilder();
azx[i] = azx[i].Replace("-", "");
for (int j = ; j < azx[i].Length; j++)
{ char cr = azx[i][j];
if (cr == 'A' || cr == 'B' || cr == 'C')
{
sb.Append("");
}
else if (cr == 'D' || cr == 'E' || cr == 'F')
{
sb.Append("");
}
else if (cr == 'G' || cr == 'H' || cr == 'I')
{
sb.Append("");
}
else if (cr == 'J' || cr == 'K' || cr == 'L')
{
sb.Append("");
}
else if (cr == 'M' || cr == 'N' || cr == 'O')
{
sb.Append("");
}
else if (cr == 'P' || cr == 'R' || cr == 'S')
{
sb.Append("");
}
else if (cr == 'T' || cr == 'U' || cr == 'V')
{
sb.Append("");
}
else if (cr == 'W' || cr == 'X' || cr == 'Y')
{
sb.Append("");
}
else
{
sb.Append(cr);
}
}
a[i] = sb.ToString();
}
int[] items = new int[a.Length];
int bbbb = ;
foreach (var item in a)
{ items[bbbb] = Convert.ToInt32(item);
bbbb++; }
QSortDIY(items, , items.Length - );
// Console.WriteLine(string.Join(",", items));
Dictionary<int, int> dic = new Dictionary<int, int>();
foreach (var item in items)
{
if (!dic.ContainsKey(item))
{
dic.Add(item, );
}
else
{
dic[item]++;
}
}
foreach (var item in dic)
{
if (item.Value!=)
{
string s = item.Key.ToString();
s= s.Insert(, "-");
Console.WriteLine(s+ " " + item.Value);
}
} } public static void MPSort(int[] array)
{
int tep;
for (int i = ; i < array.Length - ; i++)
{
for (int j = ; j < array.Length - i - ; j++)
{
if (array[j] > array[j + ])
{
tep = array[j + ];
array[j + ] = array[j];
array[j] = tep;
}
}
}
} public static void QSortDIY(int[] array, int low, int high)
{
if (low >= high)
{
return;
}
int ie = QSortUnit(array, low, high);
QSortDIY(array, low, ie - );
QSortDIY(array, ie + , high);
}
private static int QSortUnit(int[] array, int low, int high)
{
int key = array[low];
while (low < high)
{
while (array[high] >= key && high > low)
{
--high;
}
array[low] = array[high];
while (array[low] <= key && high > low)
{ ++low;
}
array[high] = array[low];
}
array[low] = key;
return high;
}
C# ACM poj1002的更多相关文章
- ACM训练计划建议(写给本校acmer,欢迎围观和指正)
ACM训练计划建议 From:freecode# Date:2015/5/20 前言: 老师要我们整理一份训练计划给下一届的学弟学妹们,整理出来了,费了不少笔墨,就也将它放到博客园上供大家参考. 菜 ...
- ACM训练计划建议(转)
ACM训练计划建议 From:freecode# Date:2015/5/20 前言: 老师要我们整理一份训练计划给下一届的学弟学妹们,整理出来了,费了不少笔墨,就也将它放到博客园上供大家参考. 菜 ...
- 北大ACM - POJ试题分类(转自EXP)
北大ACM - POJ试题分类 -- By EXP 2017-12-03 转载请注明出处: by EXP http://exp-blog.com/2018/06/28/pid-38/ 相关推荐文: 旧 ...
- SCNU ACM 2016新生赛决赛 解题报告
新生初赛题目.解题思路.参考代码一览 A. 拒绝虐狗 Problem Description CZJ 去排队打饭的时候看到前面有几对情侣秀恩爱,作为单身狗的 CZJ 表示很难受. 现在给出一个字符串代 ...
- SCNU ACM 2016新生赛初赛 解题报告
新生初赛题目.解题思路.参考代码一览 1001. 无聊的日常 Problem Description 两位小朋友小A和小B无聊时玩了个游戏,在限定时间内说出一排数字,那边说出的数大就赢,你的工作是帮他 ...
- acm结束了
最后一场比赛打完了.之前为了记录一些题目,开了这个博客,现在结束了acm,这个博客之后也不再更新了. 大家继续加油!
- 关于ACM的总结
看了不少大神的退役帖,今天终于要本弱装一波逼祭奠一下我关于ACM的回忆. 从大二上开始接触到大三下结束,接近两年的时间,对于大神们来说两年的确算不上时间,然而对于本弱来说就是大学的一半时光.大一的懵懂 ...
- 第一届山东省ACM——Phone Number(java)
Description We know that if a phone number A is another phone number B’s prefix, B is not able to be ...
- 第一届山东省ACM——Balloons(java)
Description Both Saya and Kudo like balloons. One day, they heard that in the central park, there wi ...
随机推荐
- (4)ARP:地址解析协议
一.简介 ARP为IP地址到对应的硬件地址之间提供动态映射.之所以称为动态是因为这个过程是自动完成的.一般应用程序用户或系统管理员不必关心.RARP是被那些没有磁盘驱动器的系统使用,它需要系统管理员进 ...
- Hibernate中对象的3种状态:瞬时态、持久态、脱管态
Hibernate的对象有3种状态,分别为:瞬时态(Transient). 持久态(Persistent).脱管态(Detached).处于持久 态的对象也称为PO(Persistence Objec ...
- NGUI学习笔记(一):官方视频学习记录
学习NGUI一直断断续续的,目前打算做一个总结的笔记. 我使用的是比较老的3.6.0版本. 1.使用NGUI,需要开启“Edit”->“Project Settings”->“Physic ...
- Flume + HDFS + Hive日志收集系统
最近一段时间,负责公司的产品日志埋点与收集工作,搭建了基于Flume+HDFS+Hive日志搜集系统. 一.日志搜集系统架构: 简单画了一下日志搜集系统的架构图,可以看出,flume承担了agent与 ...
- Parameterized Path 的例子
Improve the planner's ability to use nested loops with inner index scans (Tom Lane) The new "pa ...
- Start-Process传递变量
如果$b="aa,bb" Start-Process PowerShell.exe -Argumentlist "d:\w.ps1 $a $b $c" Star ...
- Android 百度地图API 定位 导航
看看这个利用百度地图定位并实现目的地导航的Demo. 首先看实现效果: 进 入后首先会得到当前位置,在地图上显示出来.在输入框中输入目的地后,就会在地 ...
- html中#include file的使用方法
有两个文件a.htm和b.htm,在同一文件夹下a.htm内容例如以下 <!-- #include file="b.htm" --> b.htm内容例如以下 今天:雨 ...
- bmp to jpg
uses Jpeg; function BMPtoJPG(var BMPpic, JPGpic: string): boolean;var Bitmap: TBitmap; JpegImg: TJ ...
- 使用百度地图结合GPS进行定位
本文在上文基础上加入GPS定位功能,实现实时定位,代码如下: Activity: package com.home; import android.app.Activity; import andro ...