mirror of
https://github.com/xlucn/PAT.git
synced 2026-10-03 00:23:15 +08:00
1.1 KiB
1.1 KiB
layout, date, title, categories, tags, permalink
| layout | date | title | categories | tags | permalink | ||
|---|---|---|---|---|---|---|---|
| post | 2017-05-05 14:56:22 +0800 | PAT Basic 1069. 微博转发抽奖 (20) (C语言实现) | Basic |
|
Basic/1069.html |
题目
{% include_relative html/b1069.md %}
思路
{% include_relative analysis/b1069.md %}
代码
Github最新代码,欢迎交流
{% raw %}#include <stdio.h>
#include <string.h>
int main()
{
char s[1000][21] = {{0}}, line[21];
int M, N, S, m, count = 0, r = 0;
scanf("%d %d %d", &M, &N, &S);
for(m = 0, S--; m < M; m++)
{
scanf("%s", line);
if(m == S + count * N + r)
{
int flag = 1;
for(int i = 0; i < count && flag; i++)
if(!strcmp(s[i], line))
{
flag = 0;
r++;
break;
}
if(flag)
strcpy(s[count++], line);
}
}
for(int i = 0; i < count; i++)
printf("%s\n", s[i]);
if(!count)
printf("Keep going...");
return 0;
}
{% endraw %}```