4 字元轉換及所在位置

2021-08-22 06:15:44 字數 1276 閱讀 4887

字元矩陣翻譯

輸入n和m,代表這個字元矩陣的行和列數,然後在接下來的n行,每行輸入乙個含有m個字元的字串。要求將這個字元矩陣中的每乙個字元,轉換為對應的字元。

轉換規則為:

對於大寫字母』a』-』z』,分別轉換為0-25

對於小寫字母』a』-』z』,分別轉換為26-51

對於其他字元,全部轉換為』x』,大寫的』x』

然後

1.輸出這個轉換後的字元矩陣

2.輸出轉換後x的數目,另外再按照行優先的順序,輸出第乙個x所在的行列(每個字元算乙個位置,例如26x,則x是第一行第三列) 行列標均從1開始

注意:題目滿足轉換後一定存在至少乙個』x』.

例如輸入:

2 3acz

@2z輸出為:

262825

xx51

2 2 1

**1:(自己寫的):

#include #include using namespace std;

int main()

else

else if(c>='a'&&c<='z')

else}}

getchar();

printf("\n");

}printf("%d ",x);

printf("%d %d",cc,rr);

return 0;

}

**2:(西交wrong):

#include #include #include #include #include #include #include #include #include #include #include #include using namespace std;

const int maxn = 100000;

typedef pairp;

int main()

else

if(c>='a'&&c<='z')

else

//'x'已經出現}}

getchar();

printf("\n");

}cout<(感謝西交wrong學長提供以上題目練習)

gcc各種優化所在位置及迴圈展開分析

generic 是一種樹 tree 的高階表示形式,目的是提供乙個語言無關的中間表示。當前 gcc 的主要優化都是基於 gimple 表示形式實現的,包括過程間優化 傳統標量優化 迴圈優化 向量化等。gcc 的 all passes 遍表中的 expand 過程將 gcc 的 gimple 表示形式...

Unreal Engine 4 字串轉換

在使用unreal engine 4 c 進行開發時,在整合其他庫時,很多時候會需要進行字串轉換,下面記錄了一些基本的轉換方法 1.fstring轉換fname fstring thestring ddddd fname myname fname thestring 2.std string轉換fs...

Unreal Engine 4 字串轉換

在使用unreal engine 4 c 進行開發時,在整合其他庫時,很多時候會需要進行字串轉換,下面記錄了一些基本的轉換方法 1.fstring轉換fname fstring thestring ddddd fname myname fname thestring 2.std string轉換fs...