4 条题解

  • 4
    @ 2022-7-4 18:41:12
    import base64
    
    print(base64.b64encode(input().encode('ascii')).decode('ascii'))
    
    • 1
      @ 2024-11-23 19:29:56

      位运算。

      #include<bits/stdc++.h>
      using namespace std;
      string s;
      char to_char(int x)
      {
      	if (x<26)
      		return x+65;
      	if (x<52)
      		return x+71;
      	if (x<62)
      		return x-4;
      	if (x==62)
      		return '+';
      	if (x==63)
      		return '/';
      }
      int main()
      {
      	getline(cin,s);
      	for (int i=0;i<s.length();i+=3)
      		printf("%c%c%c%c",to_char(s[i]>>2),to_char(((s[i]%4)<<4)+(s[i+1]>>4)),to_char(((s[i+1]%16)<<2)+(s[i+2]>>6)),to_char(s[i+2]%64));
      	return 0;
      }
      
      • 1
        @ 2024-10-18 11:57:16
        s=input()
        a=[0]*1000
        b=[0]*4000
        dic="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
        for i in range(len(s)):
            a[i]=ord(s[i])
        k=len(s)//3
        for i in range(k):
            b[i*4+0]=a[i*3+0]//4
            b[i*4+1]=a[i*3+0]%4*16+a[i*3+1]//16
            b[i*4+2]=a[i*3+1]%16*4+a[i*3+2]//64
            b[i*4+3]=a[i*3+2]%64
        for i in range(k*4):
            print(dic[b[i]],end="")
        
        • 0
          @ 2024-10-18 11:56:48
          s=input()
          a=[0]*1000
          b=[0]*4000
          dic="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
          for i in range(len(s)):
              a[i]=ord(s[i])
          k=len(s)//3
          for i in range(k):
              b[i*4+0]=a[i*3+0]//4
              b[i*4+1]=a[i*3+0]%4*16+a[i*3+1]//16
              b[i*4+2]=a[i*3+1]%16*4+a[i*3+2]//64
              b[i*4+3]=a[i*3+2]%64
          for i in range(k*4):
              print(dic[b[i]],end="")
          
          • 1

          信息

          ID
          739
          时间
          1000ms
          内存
          256MiB
          难度
          4
          标签
          (无)
          递交数
          203
          已通过
          92
          上传者