UVa 10508 - Word Morphing
来源:互联网 发布:变分原理知乎 编辑:程序博客网 时间:2024/05/03 09:09
題目:有一些長度相同的字符串,從起始字符串每次改變一個字符,轉化成其他字符,求轉化順序。
分析:簡單題。直接求出不同字符的個數排序輸出即可。
說明:題目的條件都是迷惑的\(^o^)/~。
#include <algorithm>#include <iostream>#include <cstring>#include <cstdio>using namespace std;char str[1001][1001];typedef struct _mydata{int index;int value;}mydata;mydata Item[1001];int cmp(const void *p, const void *q){mydata *a = (mydata *)p;mydata *b = (mydata *)q;return a->value - b->value;}int main(){int n, m, value;while (~scanf("%d%d",&n,&m)) {for (int i = 0; i < n; ++ i) {scanf("%s",str[i]);}for (int i = 0; i < n; ++ i) {value = 0;for (int j = 0; str[i][j]; ++ j) {value += (str[i][j] != str[0][j]);}Item[i].value = value;Item[i].index = i;}qsort(Item, n, sizeof(mydata), cmp);for (int i = 0; i < n; ++ i) {printf("%s\n",str[Item[i].index]);}}return 0;}
0 0
- UVa 10508 - Word Morphing
- Morphing
- uva 10981 - String Morphing(记忆化+离散)
- UVA 10981 - String Morphing(记忆化搜索)
- face morphing
- wait morphing
- image morphing
- CV学习-Morphing
- UVA 417 Word Index
- UVA 417 - Word Index
- UVa 483 - Word Scramble
- UVA 642 - Word Amalgamation
- Uva 417 - Word Index
- UVa 417 Word Index
- UVa 417-Word Index
- UVa 417 - Word Index
- UVa 642 - Word Amalgamation
- UVa 642 Word Amalgamation
- 斯坦福和NLTK英语短语词组抽取工具原理及源码理解
- Bitmap的加载和Cache
- Android中View转换为Bitmap及getDrawingCache=null的解决方法
- 打开android debug设备系统调试
- jQuery动画
- UVa 10508 - Word Morphing
- 输入法设置导致PowerPoint2007无法输入中文
- Swift中的函数和闭包
- 数据探索式测试(1)
- Heatmap 热力图(1)
- SecrueCRT 方向键不能使用
- CodingNet - Learning - 8
- 再一遍
- 基于FPGA的任意分频器设计