Codeforces Round #607 (Div. 2)

2868 단어 cf사고의 방향
A문제:https://codeforces.com/contest/1281/problem/A
제목: 이 문제는 출제에서 주어진 문자열이 어느 나라의 언어에 속하는지 구하라는 것이다.
사고방식: 우리가 판단하면 된다.
AC 코드:
#include 
typedef long long ll;
const int maxx=10010;
const int inf=0x3f3f3f3f;
using namespace std;
char a[maxx];
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        cin>>a;
        int alen=strlen(a);
        if(a[alen-1]=='o')
            cout<

 
B:https://codeforces.com/contest/1281/problem/B
제목: 이 문제는 두 개의 문자열을 드리겠습니다. 사전 순서에 따라 바꿀 수 있도록 앞의 문자열을 작게 하고 뒤의 문자열을 작게 할 수 있는지 확인하세요.
사고방식: 먼저 바꿀 문자열을sort 정렬을 하면 각 위치에서 교환할 최소 문자를 얻어서 교환하면 된다.
AC 코드:
#include 
typedef long long ll;
const int maxx=10010;
const int inf=0x3f3f3f3f;
using namespace std;
string a,b;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        cin>>a>>b;
        if(as[i])
            {
                for(int j=i+1;j

 
C문제:https://codeforces.com/contest/1281/problem/C
제목: 이 문제는 일련의 조작을 통해 이 조작을 거친 문자열이 어떤 모양인지 물어본다.
사고방식: 사고방식은 직접 시뮬레이션이고 문자열이 x보다 크면 시뮬레이션을 멈추면 된다.
AC 코드:
#include 
typedef long long ll;
const int maxx=10010;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
using namespace std;
int main()
{
    int t,x;
    string s;
    cin>>t;
    while(t--)
    {
        cin>>x>>s;
        int slen=s.size();
        for(int i=0; i

 
D문항:https://codeforces.com/contest/1281/problem/D
제목: 이 문제는 n행 m열의 행렬을 주는 것입니다. 행렬에는'A'와'P'만 존재합니다. 그리고 최소한 몇 걸음은 전체 행렬을'A'로 만들 수 있습니다.
사고방식: 사고방식의 경우 우리는 상황을 나누어 토론하고 줄마다 열을 두루 훑어보며 각각'A'가 양쪽에 있는지, 중간에 있는지, 아니면 한 줄이 모두 그런 상황인지 토론해야 한다.그리고 우리가 판단할 수 있는 경우 걸음의 범위 구간은 [0,4]이다.
AC 코드:
#include 
typedef long long ll;
const int inf=0x3f3f3f3f;
const int maxn=10010;
using namespace std;
int t,n,m;
char a[maxn][maxn];
int main()
{
    cin>>t;
    while(t--)
    {
        int foundA=0, foundP=0, ans=4;
        cin>>n>>m;
        for (int i=1; i<=n; i++)
        {
            for (int j=1; j<=m; j++)
                cin>>a[i][j];
        }
        for(int i=1; i<=n; i++)
        {
            for(int j=1; j<=m; j++)
                if (a[i][j]=='A')
                    foundA=1;
                else
                    foundP=1;
        }
        if(!foundA)
        {
            cout<

좋은 웹페이지 즐겨찾기