http://oj.lcsyzx.cn/JudgeOnline/problem.php?id=1049
var a : string[10]; m,n,t : integer; begin readln(m); n:= 0; t:= m ; while m > 0 do begin readln(a); Case a[1] of { 关于情况处理 } ‘A‘,‘B‘,‘C‘,‘D‘,‘E‘,‘F‘,‘G‘,‘R‘,‘S‘,‘T‘ : n := n + 1; end; m := m - 1; end; writeln(t - n); end.
#include <iostream> #include <iomanip> #include <cstdlib> #include <string> using namespace std; int main(){ int n; int m = 0; string a; cin>>n; while(n-->0) { cin>>a; switch(a[0]) { case ‘A‘: case ‘B‘: case ‘C‘: case ‘D‘: case ‘E‘: case ‘F‘: case ‘G‘: case ‘R‘: case ‘S‘: case ‘T‘: m++; break; } } cout<<m<<endl; // cout<<setiosflags(ios::fixed)<<setprecision(4)<<s<<endl; // cout<< setiosflags(ios::fixed)<<setprecision(4) <<c<<endl; }
时间: 2024-10-10 09:50:16