The score of 'O' and 'X'
題目描述
注意要點:
- 使用strlen函式注意加標頭檔案
#inlcude <cstring>
- 迴圈巨集定義for迴圈
#define _for(i,a,b) for(int i=(a);i<(b);++i)
程式碼實現
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <cstring> #define _for(i,a,b) for(int i=(a);i<(b);++i) //迴圈巨集定義for迴圈 using namespace std; int main() { int T; //測試樣例的組數 char buf[128]; scanf("%d\n",&T); while(T--){ gets(buf);//此處是用gets函式讀入 int cnt=0,sum=0,sz=strlen(buf); //在CPP中需要引用#include <cstring> _for(i,0,sz){ if(buf[i]=='O') sum+=(++cnt);//sum是累加的,cnt遇到字元X會清0 else cnt = 0; } printf("%d\n",sum); } return 0; }
相關推薦
The score of 39;O39; and 39;X39;
題目描述 注意要點: 使用strlen函式注意加標頭檔案#inlcude <cstring> 迴圈巨集定義for迴圈#define _for(i,a,b) for(int i=(a);i<(b);++i) 程式碼實現 #include <iostream>
好記心不如爛筆頭,ssh登錄 The authenticity of host 192.168.0.xxx can39;t be established. 的問題
ble public 輸入 iss 解決 rec sta erp mis The authenticity of host ‘git.coding.net (123.59.85.184)‘ can‘t be established.RSA key fingerprint i
The authenticity of host 192.168.0.xxx can39;t be established
ctrl 解決 oss 解決方案 can str com cit ip地址 用ssh登錄一個機器(換過ip地址),提示輸入yes後,屏幕不斷出現y,只有按ctrl + c結束 錯誤是:The authenticity of host 192.168.0.xxx can‘
GIT ssh登入 The authenticity of host 192.168.0.xxx can39;t be established. 的問題
GIT ssh登入 The authenticity of host 192.168.0.xxx can’t be established. 的問題(轉) 原文連結:http://blog.csdn.net/kimsoft/article/details/5865418 用ssh登入
2-2ssh登入 The authenticity of host 192.168.0.xxx can39;t be established. 的問題
用ssh登入一個機器(換過ip地址),提示輸入yes後,螢幕不斷出現y,只有按ctrl + c結束 錯誤是:The authenticity of host 192.168.0.xxx can't be established. 以前和同事碰到過這個問題,
好記心不如爛筆頭,ssh登入 The authenticity of host 192.168.0.xxx can39;t be established. 的問題
用ssh登入一個機器(換過ip地址),提示輸入yes後,螢幕不斷出現y,只有按ctrl + c結束 錯誤是:The authenticity of host 192.168.0.xxx can't be established. 以前和同事碰到過這個問題,解決了,沒有記錄,
[Javascript] Automate the process of flattening deeply nested arrays using ES201939;s flat method
prototype eas rip fin nbsp Language con may make Among the features introduced to the language of JavaScript in ES2019 is Array.prototype
The Transformation of Healthcare with AI and Machine Learning
Research in cutting-edge areas like machine learning continues to demonstrate that computers have the potential to predict outcomes and enhance physicians'
Exploring the future of learning through virtual and augmented reality
At a recent on-campus symposium titled “VR, Sound and Cinema: Implications for Storytelling and Learning,” MIT Open Learning explored the future of storyte
The costs of functional gastrointestinal disorders and related signs and symptoms in infants: a…
Mahon J, Lifschitz C, Ludwig T, Thapar N, Glanville J, Miqdady M, et al. BMJ Open. 2017;7(11).OVER £72 million is spent each year in England to manage func
Did You Know that the Future of HVAC is AI and IoT?
AI will play a large role in the era of Big Data. We have no doubt because the future of HVAC reveals AI and IoT. The debate about IoT market strategies wi
Caching the result of methods using Spring and EHCache
原址:[url]http://opensource.atlassian.com/confluence/spring/display/DISC/Caching+the+result+of+methods+using+Spring+and+EHCache[/url]Introdu
解決Gradle執行命令時報Could not determine the dependencies of task ':compileReleaseJava'.
內容 oid 兩個 jsb pan mpi 技術分享 android undle Could not determine the dependencies of task ‘:compileReleaseJava‘. > failed to find targe
報錯:illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation 39;=39;
imp ner 解決方法 block wid sql cit 編碼 不知道 sql語句: select t1.block_info, t2.zone from device_indoor_tbl t1 left join blackwhitezone_tbl t2 o
The authenticity of host 39;github.com (192.30.253.113)39; can39;t be established.
但是 rsa address rem can ssh 回車 print tor 在初始化git之後(git init),同時在github建立好倉庫之後,本地也新增了ssh kye(ssh-keygen -t rsa -C ‘mail address’),同時也在本地新
Django:創建用戶模型報錯: (admin.E108) The value of 39;list_display[4]39;解決方案
png str 行數 div bool 解析 創建 delet sts 參考資料:蟲師-《web接口開發與自動化測試:基於python語言》 日常學習Django框架中,創建了用戶模型,但是頁面功能驗證時候,提示不能進行列表字段操作,debug好久,才找到問題原因,心累。。
Warning: Permanently added the RSA host key for IP address 39;52.74.223.11939; to the list of known hosts.
IT hub 說明 ESS IV 公鑰 RM style ssh 如果出現這個問題,說明你的github缺少公鑰 使用 ssh -T [email protected] 去測試 1.生成密鑰 ssh-keygen -t rsa -C "your name" #引號裏輸入你的用
Permanently added the RSA host key for IP address 39;192.30.253.11339; to the list of known hosts.
refs forward 本地 total warn 其中 rom ip add forwards $git push origin master 報錯: Warning: Permanently added the RSA host key for IP address
pod react 之 [!] The name of the given podspec `yoga` doesn39;t match the expected one `Yoga
[!] The name of the given podspec `yoga` doesn't match the expected one `Yoga 解決辦法: 1、我的Yoga的路徑不對,看截圖 我的node_modules資料夾是在我的專案的根目錄下,所以我修改路徑
sum of rabbits who whelp and won39;t die
古典問題:有一對兔子,從出生後第3個月起每個月都生一對兔子,小兔子長到第三個月 後每個月又生一對兔子,假如兔子都不死,問每個月的兔子總數為多