1 solutions

  • 0
    @ 2025-12-15 11:55:29

    C++ :

    #include<iostream>
    using namespace std;
    int main()
    {
    	string str;
    	int c,s;
    	while(getline(cin,str))
        {
            c=0;
            s=0;
    		for(int i=0;i<str.size();i+=2)
    		{
    			switch (str[i])
    			{
    			case 'A':s+=4;break;
    			case 'B':s+=3;break;
    			case 'C':s+=2;break;
    			case 'D':s+=1;break;
    			case 'F':s+=0;break;
    			default:c++;
    			}
    		}
    		if(c>0)cout<<"Unknown"<<endl;
    		else cout<<s<<endl;
        }
    	return 0;
    }
    
    • 1

    Information

    ID
    1031
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By