下载的测试点都能过 样例也能过 为啥0分啊 有大佬来救救吗
  • 板块P1765 手机
  • 楼主magicmelonG
  • 当前回复6
  • 已保存回复6
  • 发布时间2022/11/12 12:41
  • 上次更新2023/10/27 03:17:12
查看原帖
下载的测试点都能过 样例也能过 为啥0分啊 有大佬来救救吗
731172
magicmelonG楼主2022/11/12 12:41
#include <iostream>
#include<string>
using namespace std;

int main()
{
    string a;
   getline(cin, a);
    int count = 0;
    for (int i = 0; i < a.length(); i++) {
        if (a[i] == 'a' | a[i] == 'd' | a[i] == 'g' | a[i] == 'j' | a[i] == 'm' | a[i] == 'p' | a[i] == 't' | a[i] == 'w' | a[i] == ' ') {
            count++;
       
        }
        else if (a[i] == 'b' | a[i] == 'e' |a[i] == 'h' | a[i] == 'k' | a[i] == 'n' | a[i] == 'q' | a[i] == 'u' | a[i] == 'x') {
            count += 2;
       
        }
        else if (a[i] =='c' | a[i] == 'f' | a[i] == 'i' | a[i] == 'l' | a[i] == 'o' | a[i] == 'r' | a[i] == 'v' | a[i] == 'y') {
            count += 3;
            
        }
        else {
            count += 4;
           
        }
    }
    cout << count;
}
2022/11/12 12:41
加载中...