P1603 斯诺登的密码

//
// Created by Sween'e'y on 2022/8/15.
//
//P1603 斯诺登的密码

#include <iostream>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <deque>
#include <array>
#include <set>
#include <map>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <climits>
#include <string>
#include <cstring>
#include <cctype>
#include <cassert>

using namespace std;
const double PI = acos(-1);


struct cmp {
    bool operator()(int a, int b) {
          return a > b;
    }
};

template<class T>
int length(T &array) {
      return sizeof(array) / sizeof(array[0]);
}

bool is_prime[100007];

void ai() {
      for (int i = 2; i <= 100000; i++) {
            is_prime[i] = 1;
      }
      for (int i = 2; i <= 100000; i++) {
            if (is_prime[i]) {
                  for (int j = 2 * i; j <= 100000; j += i) {
                        is_prime[j] = 0;
                  }
            }
      }
}

int numberInversion(int x) {
      int num = 0;
      while (x != 0) {
            num = num * 10 + x % 10;
            x /= 10;
      }
      return num;
}

double half(double x) {
      return x / 2;
}

string half(string s) {
      int n = s.length() / 2;
      char *str = new char[n];
      for (int i = 0; i < n; i++) {
            str[i] = s[i];
      }
      return str;
}
//转换函数

int convert(string s) {
      if (s == "one") {
            return 1;
      } else if (s == "two") {
            return 2;
      } else if (s == "three") {
            return 3;
      } else if (s == "four") {
            return 4;
      } else if (s == "five") {
            return 5;
      } else if (s == "six") {
            return 6;
      } else if (s == "seven") {
            return 7;
      } else if (s == "eight") {
            return 8;
      } else if (s == " nine") {
            return 9;
      } else if (s == "ten") {
            return 10;
      } else if (s == "eleven") {
            return 11;
      } else if (s == "twelve") {
            return 12;
      } else if (s == "thirteen") {
            return 13;
      } else if (s == "fourteen") {
            return 14;
      } else if (s == "fifteen") {
            return 15;
      } else if (s == "sixteen") {
            return 16;
      } else if (s == "seventeen") {
            return 17;
      } else if (s == "eighteen") {
            return 18;
      } else if (s == "nineteen") {
            return 19;
      } else if (s == "twenty") {
            return 20;
      } else if (s == "a") {
            return 1;
      } else if (s == "both") {
            return 2;
      } else if (s == "another") {
            return 1;
      } else if (s == "first") {
            return 1;
      } else if (s == "second") {
            return 2;
      } else if (s == "third") {
            return 3;
      } else if (s == "zero") {
            return 0;
      } else {
            return 0;
      }
}

int main() {
      //true
      string s[100];
      int arr[100] = {0}, flag = 0;
      for (int i = 0; i < 7; i++) {
            cin >> s[i];
      }
      //  抛弃.
      for (int i = 0; i < 6; i++) {
            arr[i] = convert(s[i]);
      }
      for (int i = 0; i < 6; i++) {
            arr[i] = (arr[i] * arr[i]) % 100;
      }
      sort(arr, arr + 6);
      for (int i = 0; i < 6; i++) {
            if (arr[i]) {
                  if (flag) {  //后面的不足两位补零,关键点
                        printf("%02d", arr[i]);
                  } else {
                        if (arr[i]) {  //第一位数前导不为零
                              printf("%d", arr[i]);
                              flag = 1;
                        }
                  }
            }
      }
      if (!flag) {
            printf("0");
      }

      return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值