What a Simple Research

Problem F. What a Simple Research

Description

Peking University Student Folk MusicBand has a history of more than 90 years. They play Chinese traditional musicby Chinese traditional instruments, such as Pipa, Erhu and Guzheng, etc. DoctorLi is a member of that band, and also a former ACMer. Now he is doing someresearch on Chinese ancient music. Many Chinese ancient music has only five kindsof tones, which can be denoted by 'C','D','E','G', and 'A'. Given a piece of musicscore, Li wants to do some simple statistics.

Input

There are no more than 20 test cases.

In each test case:

The first line contains two integers nand m (2<= n,m <= 20), indicating that a piece of music score isrepresented by an n×m matrix of tones. Only 'C','D','E','G' and 'A' can appear in thematrix.

Then the n×m matrix follows.

The input ends with a line of "00".

Output

For each test case:

For each kind of tone shown in thematrix, calculate the appearing times of it, and print the result in descendingorder according to the appearing times. If more than one kind of tones has thesame appearing times, print them in the lexicographical order.

Sample Input

4 5

AGCDE

AGDDE

DDDDD

EEEEE

2 4

GADC

CDEE

0 0

SampleOutput

D 8 E 7 A 2 G 2 C 1

C 2 D 2 E 2 A 1 G 1

题意:求一个矩阵中各个字母出现的次数。比较简单,模拟求解。

Code:

#include<cstdio>
#include<algorithm>
using namespace std;
struct node
{
	char c;
	int x;
}h[6];
bool cmp(node a,node b)
{
	return a.x>b.x;
}
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	while (n!=0 && m!=0)
        {
		char ch[100];
		for (int i=1;i<=5;i++) h[i].x=0;
		for (int i=1;i<=n;i++)
                {
			scanf("%s",ch);
			for (int j=0;j<m;j++)
                        {
				if (ch[j]=='A') h[1].x++;
				if (ch[j]=='C') h[2].x++;
				if (ch[j]=='D') h[3].x++;
				if (ch[j]=='E') h[4].x++;
				if (ch[j]=='G') h[5].x++;
			}	
		}
		h[1].c='A',h[2].c='C',h[3].c='D',h[4].c='E',h[5].c='G';
		sort(h+1,h+6,cmp);
		int p=5;
		for (int i=1;i<=5;i++)
                {
			if (h[i].x==0)
                        {
				p=i-1;
				break;
			}
		}
		for (int i=1;i<=p-1;i++) printf("%c %d ",h[i].c,h[i].x);
		printf("%c %d\n",h[p].c,h[p].x);
		scanf("%d%d",&n,&m);
	}
	return 0;
}

 

## Flux Kontext Prompt Techniques ### 1. Basic Modifications - Simple and direct: `"Change the car color to red"` - Maintain style: `"Change to daytime while maintaining the same style of the painting"` ### 2. Style Transfer **Principles:** - Clearly name style: `"Transform to Bauhaus art style"` - Describe characteristics: `"Transform to oil painting with visible brushstrokes, thick paint texture"` - Preserve composition: `"Change to Bauhaus style while maintaining the original composition"` ### 3. Character Consistency **Framework:** - Specific description: `"The woman with short black hair"` instead of "she" - Preserve features: `"while maintaining the same facial features, hairstyle, and expression"` - Step-by-step modifications: Change background first, then actions ### 4. Text Editing - Use quotes: `"Replace 'joy' with 'BFL'"` - Maintain format: `"Replace text while maintaining the same font style"` ## Common Problem Solutions ### Character Changes Too Much ❌ Wrong: `"Transform the person into a Viking"` ✅ Correct: `"Change the clothes to be a viking warrior while preserving facial features"` ### Composition Position Changes ❌ Wrong: `"Put him on a beach"` ✅ Correct: `"Change the background to a beach while keeping the person in the exact same position, scale, and pose"` ### Style Application Inaccuracy ❌ Wrong: `"Make it a sketch"` ✅ Correct: `"Convert to pencil sketch with natural graphite lines, cross-hatching, and visible paper texture"` ## Core Principles 1. **Be Specific and Clear** - Use precise descriptions, avoid vague terms 2. **Step-by-step Editing** - Break complex modifications into multiple simple steps 3. **Explicit Preservation** - State what should remain unchanged 4. **Verb Selection** - Use "change", "replace" rather than "transform" ## Best Practice Templates **Object Modification:** `"Change [object] to [new state], keep [content to preserve] unchanged"` **Style Transfer:** `"Transform to [specific style], while maintaining [composition/character/other] unchanged"` **Background Replacement:** `"Change the background to [new background], keep the subject in the exact same position and pose"` **Text Editing:** `"Replace '[original text]' with '[new text]', maintain the same font style"` > **Remember:** The more specific, the better. Kontext excels at understanding detailed instructions and maintaining consistency. 翻译
最新发布
07-01
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

JackflyDC

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值