文件名称:uva10324
介绍说明--下载内容均来自于网络,请自行研究使用
uva 10324
題目說明 :
給你一連串僅包含0和1的字串(字串長度最大到1000000,字串從第0個字元開始),要請你回答我們在第i個和第j個字元之間
(包含第i個和第j個),是否所有的字元均相同(均為1或均為0)。如果均相同請回答Yes,否則請回答No。
Input
每筆測試資料的第一列為一個僅包含0和1的字串,下一列有1個整數n,代表對於上一列字串以下有n個問題。皆下來的 n 列,
每列有2個非負的整數,分別代表 i和 j。
Output
對每一列測試字串,請先輸出第幾個 Case。然後根據 n 個問題回答 Yes 或 No。
解法 :
1. 用 gets 讀入整行字串輸入,並計算長度
2. 先判斷第 0 個位置,為 0 則把 0 存入另一個整數陣列,為 1 則存 1
3. 用 for 迴圈把字串陣列轉換存到整數陣列,遇到字元 0 則值不變,遇到字元 1 則加 1
4. 欲判斷的i,j位置都為字元 0 ,且整數陣列i,j位置的值相同,代表有一連串 0 ,輸出 Yes
5. 欲判斷的i,j位置都為字元 1 ,且整數陣列i,j位置的值相減為i,j的差,代表有一連串 1 ,輸出 Yes
6. 其他情況輸出 No-uva 10324 Title Descr iption: give you a series of strings that contains only 0 and 1 (maximum string length to 1,000,000, character string starting 0), to ask you to answer our i-th and the j characters of the Inter (including the i-th and j-th), if all the characters are the same (both are 1 or 0). If you have the same answer Yes, or answer No. The first column of each test Input data string contains only 0 and 1, the next column has an integer n, representatives of the following string to the previous column has n problems. Are down n columns, each have two non-negative integer representing the i and j. Output test string for each column, please output the first of several Case. Then answer Yes or No. according to n a problem Solution: 1. read the entire line gets input string, and calculate the length of 2 to determine the position of the first 0, 0 put 0 into another integer array that is a deposit for loop 1 3. Use the string array to an integer array to convert stored encounter
題目說明 :
給你一連串僅包含0和1的字串(字串長度最大到1000000,字串從第0個字元開始),要請你回答我們在第i個和第j個字元之間
(包含第i個和第j個),是否所有的字元均相同(均為1或均為0)。如果均相同請回答Yes,否則請回答No。
Input
每筆測試資料的第一列為一個僅包含0和1的字串,下一列有1個整數n,代表對於上一列字串以下有n個問題。皆下來的 n 列,
每列有2個非負的整數,分別代表 i和 j。
Output
對每一列測試字串,請先輸出第幾個 Case。然後根據 n 個問題回答 Yes 或 No。
解法 :
1. 用 gets 讀入整行字串輸入,並計算長度
2. 先判斷第 0 個位置,為 0 則把 0 存入另一個整數陣列,為 1 則存 1
3. 用 for 迴圈把字串陣列轉換存到整數陣列,遇到字元 0 則值不變,遇到字元 1 則加 1
4. 欲判斷的i,j位置都為字元 0 ,且整數陣列i,j位置的值相同,代表有一連串 0 ,輸出 Yes
5. 欲判斷的i,j位置都為字元 1 ,且整數陣列i,j位置的值相減為i,j的差,代表有一連串 1 ,輸出 Yes
6. 其他情況輸出 No-uva 10324 Title Descr iption: give you a series of strings that contains only 0 and 1 (maximum string length to 1,000,000, character string starting 0), to ask you to answer our i-th and the j characters of the Inter (including the i-th and j-th), if all the characters are the same (both are 1 or 0). If you have the same answer Yes, or answer No. The first column of each test Input data string contains only 0 and 1, the next column has an integer n, representatives of the following string to the previous column has n problems. Are down n columns, each have two non-negative integer representing the i and j. Output test string for each column, please output the first of several Case. Then answer Yes or No. according to n a problem Solution: 1. read the entire line gets input string, and calculate the length of 2 to determine the position of the first 0, 0 put 0 into another integer array that is a deposit for loop 1 3. Use the string array to an integer array to convert stored encounter
(系统自动生成,下载前可以参看下载内容)
下载文件列表
uva10324\uva10324#a.in.txt
........\uva10324#a.out.txt
........\uva10324#b.in.txt
........\uva10324#b.out.txt
........\uva10324_1101105324.cpp
........\uva10324_1101105324.exe
........\uva10324_readme.txt
uva10324