【HDOJ】1062 Text Reverse
#include<iostream>
#include<string>
using namespace std;
void main()
{
int T;
while (cin>>T)
{
getchar();
for (int i = 0; i < T; i++)
{
string str;
getline(cin, str);
int end = 0,top = 0;
while (str[end] != ‘\0‘)
{
if (str[end]==‘ ‘)
{
for (int i = end-1; i >=top; i--)
{
cout << str[i];
}
top = end + 1;
}
end++;
}
if (str[end]==‘\0‘)
{
for (int i = end; i >=top-1; i--)
{
cout << str[i];
}
}
cout << endl;
}
}
}
【HDOJ】1062 Text Reverse
相關推薦
【HDOJ】1062 Text Reverse
main har getline eve names ace pac string ostream #include<iostream>#include<string>using namespace std;void main(){ int T; w
Java——HDOJ——1062 Text Reverse
Text Reverse Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 38304 A
【Sublime】Sublime Text 2集成TortoiseSVN插件
select term man ide targe spa mman 進行 borde 作者:zhanhailiang 日期:2014-09-30 1. 下載TortoiseSVN。將其安裝在默認位置; 2. 使用Sublime包管理器下載安裝Torto
【工具】Sublime Text 自動保存功能
簡單 images log 失去焦點 找到 英文 ctrl http 分享 經常需要所以要頻繁用到"ctrl+s"保存還是挺麻煩的,所以有的人需要用到失去焦點自動保存功能,這裏簡單記錄下 1、點擊"Preferences"裏的設置-用戶,有的版本是英文 2、ctrl+f找
HDU 1062 Text Reverse
題意 pri %d sta include AR mes sin sca 題目鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=1062 題意:轉置一個字符串內的所有單詞。 解法:讀取‘ ’或‘\0’作為一個單詞結束的標記,可用頭文件
【HDOJ】A Math Problem(對pow()的理解)
題意 hdu pan 打了 AC 輸入 show color 執行效率 A Math Problem http://acm.hdu.edu.cn/showproblem.php?pid=6182 題意:輸入一個n,問有多少個k的k次冪<=n(k=1,2,3...) 思
【HDOJ】1874-暢通工程續(最短路徑dijkstra)
amp include using get dijk 找到 間距 距離 ace 1874-暢通工程續 http://acm.hdu.edu.cn/showproblem.php?pid=1874 題意:略。 思路:最短路dijkstra模板,不過要先要把題裏輸入的把兩點間距
【HDOJ】find your present (2)(思路題)
利用 自己 names namespace pro ble get nbsp tdi find your present (2) 題意:找有唯一一個出現奇數次的數 思路:利用位異或。一個數異或自己本身是0; #include<stdio.h> int
【leetcode】68. Text Justification
end etc bsp interval tin 思路 object 代碼 最後一行 題目如下: 解題思路:解題方法沒啥好說的,按題目要求來,最後一行左對齊,以及空格數不能被均分的時候,從左往右優先分配。 代碼如下: class Solution(object):
【HDOJ】1153 Magic Bitstrings【組合數學】
mod 方法 %d 規律 constant namespace pro 最小 can 傳送門: Magic Bitstrings 思路 菜逼終究是菜逼,首先表示題目沒讀懂。看了別人的翻譯之後,總算讀懂題了。 然後公式推不出來,菜哭了。 把矩陣列出來 a[1%n], a[2%
【hdoj】1251 統計難題 【數據結構-Trie樹裸題】
lse show sin int 前綴 lock 參考 需要 hdu 傳送門:統計難題 題意: 字典樹裸題。 分析 字典樹板子,但是這題需要註意一點。 關於字典樹的只是可以參考hihocoder hiho一下 第二周 用G++提交會爆內存(Memory Limit Exce
【20181101】MySQL text型別的column設定為NOT NULL 導致主從1364
環境 系統版本 : CentOS release 6.8 (Final) MySQL版本:5.6.29-log MySQL Community Server (GPL) MySQL主從配置資訊 binlog format :MIXED sql_mode: NO_AUTO_CREATE_USE
【20181101】MySQL text類型的column設置為NOT NULL 導致主從1364
5.1 uniq .... 詳細 明顯 方案 read 通過 mat 環境 系統版本 : CentOS release 6.8 (Final) MySQL版本:5.6.29-log MySQL Community Server (GPL) MySQL主從配置信息 binl
【Mac】Sublime Text 常用快捷鍵
Sublime Text 常用快捷鍵(MAC) 符號說明 ⌘:command ⌃:control ⌥:option ⇧:shift ↩:enter ⌫:delete 開啟/關閉/前往 快捷鍵 功能 ⌘
【Web】Sublime Text 3 連接sftp/ftp(遠程服務器)
idt src https pack tro 技術 同步 常用 tps 在 Win 下常用 Xftp 軟件來和遠程服務傳遞文件,但是要是在項目開發的時候頻繁的將遠程文件拖到本地編輯然後再傳回遠程服務器,那真是麻煩無比,但是Sublime中SFTP插件,它讓這世界美好了許
【Web】Sublime Text 3 連線sftp/ftp(遠端伺服器)
在 Win 下常用 Xftp 軟體來和遠端服務傳遞檔案,但是要是在專案開發的時候頻繁的將遠端檔案拖到本地編輯然後再傳回遠端伺服器,那真是麻煩無比,但是Sublime中SFTP外掛,它讓這世界美好了許多。Sublime下的SFTP,只要 Ctrl+S 即可同步本地到伺服器 使用步驟 1、安裝Subl
【hdoj】3007 Buried memory 【計算幾何--最小圓覆蓋】
傳送門:Buried memory 蒼天饒過誰,第三次在hdoj上 交計算幾何的題了,沒一次是AC的。 ┭┮﹏┭┮都是模板題啊,我都是抄板子的啊,為什麼會這樣,我怎麼這麼菜。 題意: 求最小圓覆蓋 的 圓心,半徑,保留2位小數 分析 我的程式碼參考的是 俞勇老師的 《ACM國際大學生程式設計競賽 演
【安裝】sublime text 3 漢化外掛
A.輸入快捷鍵Ctrl+Shift+P 在出現的文字框中輸入Install Package(或直接輸入“ip”)選中packageControl:Install Package並回車 ,然後在輸入框中輸入“localization”就會發現漢化語言的相關外掛,最後點選主頁面選單的
演算法設計與分析課作業【week7】leetcode--151. Reverse Words in a String
題目 Given an input string, reverse the string word by word. Example: Input: "the sky is blue", Output: "blue is sky the". Note: A wo
【LeetCode】145.Text Justification
題目描述(Hard) Given an array of words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully