美文网首页
2020-08-05 斯诺登的密码

2020-08-05 斯诺登的密码

作者: JalorOo | 来源:发表于2020-08-05 23:41 被阅读0次

https://www.luogu.com.cn/problem/P1603

#include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
using namespace std;

long long qmi(int m, int k)
{
    int res = 1, t = m;
    while (k)
    {
        if (k&1) res = res * t;
        t = t * t;
        k >>= 1;
    }
    return res;
}


int read(){
    int x = 0,f = 1;
    char c = getchar();
    while (c<'0'||c>'9') {
        if (c=='-') {
            f = -1;
        }
        c = getchar();
    }
    while (c>='0'&&c<='9') {
        x = x*10+c-'0';
        c = getchar();
    }
    return x*f;
}

char dic[30][20]={"zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty","a","both","another","first","second","third"};//对应
int di[30]={0,1,4,9,16,25,36,49,64,81,00,21,44,69,96,25,56,89,24,61,0,1,4,1,1,4,9};
unsigned long long int a[10],top,flag;
int i,j;
char s[100];
int main()
{
     for(i=1;i<=6;i++)
     {
          cin>>s;//%s读入遇到空格就停止
          for(j=1;j<=26;j++)
          {
               if(!strcmp(s,dic[j]))//strcmp(s1,s2);如果他们相同,返回0
               {
                    a[++top]=di[j];//用数组存储
                    break;//立即停止寻找
               }
          }
      }
      sort(a+1,a+top+1);//贪心,使越小的数越靠前输出
      for(i=1;i<=top;i++)
      {
           if(flag)//如果不是第一位
           {
                printf("%.2d",a[i]);//限制格式输出
           }
           else
           {
                if(a[i])
                {
                     printf("%d",a[i]);
                     flag=1;
                }
            }
     }
     if(!flag)printf("0");//特判
     return 0;
}
/*
5
abc
aaaa
abc
abcc
12345
============
4
*/

相关文章

  • 2020-08-05 斯诺登的密码

    https://www.luogu.com.cn/problem/P1603

  • “地下王国”传说

    关于“地心人”之说。还记得当时火遍全世界的斯诺登么,据说斯诺登当时手里就掌握着,美国关于“地心人”的资料。斯诺登曝...

  • 斯诺登

    这部人物传记,借助全球恶名的棱镜计划事件,完美的刻画了一个高中毕业立志从军、因伤退伍后发挥编程才华为国效力、忠于爱...

  • 【洛谷 P1603】斯诺登的密码

    斯诺登的密码(题目链接) 方法 使用map做字典,解析出单词与数字的对应关系 使用sort排序,然后按照条件输出 代码

  • 胜利下的阴影

    《新闻周刊》在2017年1月20日刊文,回顾斯诺登时间带给我们的思考。文中主要阐述了斯诺登事件中民众对于斯诺登英雄...

  • 斯登

    “不懂斯登,你就不懂斯诺克”,可见斯登在斯诺克中的重要性,职业比赛中,球员也是大量用到斯登效果。 stun(斯登,...

  • 《斯诺登观后》

    半个多月前,希拉里和川普竞选期间,室友是极力支持川普的,以至于当风吹向希拉里的时候,他陷入了轻微的焦虑,我说你搁中...

  • 斯诺登的魔方

    在《斯诺登》这部电影中,魔方起到了关键性作用,但有很多人看完电影之后很疑惑,斯诺登真的是通过魔方把数据从夏威夷偷出...

  • sort+结构体

    基本 斯诺登密码 例题 设有n个正整数(n≤20),将它们联接成一排,组成一个最大的多位整数。例如:n=3时,3个...

  • SPI

    爱德华·斯诺登 Serial Peripheral Interface Bus (or SPI) interfac...

网友评论

      本文标题:2020-08-05 斯诺登的密码

      本文链接:https://www.haomeiwen.com/subject/jfuarktx.html