这题比较简单
#include<iostream>
#include<algorithm>
#include<list>
#include<cstdio>
#include<stack>
#include<string>
#include<cstring>
#define MAXN 200005
using namespace std;
char s[MAXN];
bool A[MAXN],AI[MAXN],F[MAXN];
int main(){
long n,x1=0,x2=0,x3=0;
scanf("%ld",&n);
char x;
scanf("%c",&x);
for(int i=0;i<n;i++){
scanf("%c",&x);
s[i] =x;
switch(x){
case 'A': x1++;break;
case 'F': x2++;break;
case 'I': x3++;
}
}
int i,j,k,len=n;
long ans=0;
for(i=0;i<len;i++){
if (s[i]=='A' && n-1==x2+x1-1)
ans++;
else if (s[i]=='I' && n-1==x2+x1) ans++;
}
cout<<ans;
return 0;
}
分享到:
相关推荐
题意: 给了一堆楼 要求 不能存在 i < j> aja_jaj < aka_kak 的情况 不一定非要挨着 楼高有限制 不得超过mim_imi 官方题解是 单调栈 正着一遍 反着一遍就可以了 正着:dp[i]前i个保持递增序列的最大前缀...
Bulls and Cows,在linux下编译成功,完整程序
bulls_and _cows.py
Bulls-and-Cows-game
测试数据
Pro Java 6 3D Game Development: Java 3D, JOGL, JInput and JOAL APIs Create strange lands filled with mysterious objects (cows frozen in <br>blocks of ice, chirping penguins, golden globes with ...
poj 2430 Lazy Cows.md
USACO题目Milking Cows及代码解析
玩家(计算机和你)使用从 1 到 9 的数字想出一个秘密的三位数字,没有任何重复。 游戏的目标是先轮流猜出对手的秘密号码。 猜中的奶牛数是猜中的数字和对手的秘密数字中但位置不同的数字的数量。...
带有排行榜的 Bulls and Cows 游戏的 node.js 实现 分叉了优秀的: : 安装 下载并安装 node.js 和 npm 和 mongodb 跑步 转到您将克隆此 repo 的目录并运行: git clone ...
cows_and_bulls 经典的牛与牛游戏。 现场演示: : Bulls and Cows(也称为Cows and Bulls或Pigs and Bulls)是供两个或两个以上玩家使用的打破常规的思维或纸和铅笔游戏,早于商业发行的棋盘游戏Mastermind。
前端JS Tonko的Hack-Burgaria JS存储库 ================================== 这是不同星期和任务的说明,以后的TODO ... ... Cows and bulls game, using console nodejs for running and prompt for
Pro Java 6 3D Game Development: Java 3D, JOGL, JInput and JOAL APIs Create strange lands filled with mysterious objects (cows frozen in <br>blocks of ice, chirping penguins, golden globes with ...
The cows in farmer John's herd are numbered and branded with consecutive integers from 1 to N (1 ,000,000). When the cows come to the barn for milking, they always come in sequential order from 1 to N...
bulls_and_cows
P8898 [USACO22DEC] Feeding the Cows B 题解.docx
这是一个互动式的网页,使用HTML , CSS和JavaScript制作而成,是原始的Bulls and Cows游戏的数字版本。 使用的工具和语言: 下载和用法: 可以从github Web界面将代码下载为压缩的zip文件。 还可以使用以下方法...
Effect of mastitis on milk of hybrid Sudanese cows,Ali Ahmed Hassabo,,This research aims to study the phenomenon of spreading mastitis among the Sudanese crossbred dairy cows fresian X Kenana (FXK)...
Cows in the us