跳到正文

个人记录

A

chenzhuo66约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年3月29日
篇幅
约 1 分钟

版本

  1. v1当前
C++
//[WTC 002 A] 电报
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a=0,b=0,c=0,d=0;
	string str;
	cin>>str;
    string word;
    for(int i=0;i<str.length();i++){
        if(str[i]=='.'){
            a++;
        }else if(str[i]=='-'){
            b+=2;
        }
    }
    c=a+b;
    while(c!=0){
    	d=c%10;
    	if(d==0) cout<<"A";
    	else if(d==1) cout<<"B";
    	else if(d==2) cout<<"C";
    	else if(d==3) cout<<"D";
    	else if(d==4) cout<<"E";
    	else if(d==5) cout<<"F";
    	else if(d==6) cout<<"G";
    	else if(d==7) cout<<"H";
    	else if(d==8) cout<<"I";
    	else if(d==9) cout<<"J";
    	c/=10;
	}
}
原文