This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
這題還得用到排序,是可以不用,我會把那個方法寫在最後,但不建議用這種方法,可能會 TLE(我沒測試過),而且泛用性(適用性)很小。 | |
不使用排序,還可以使用像 priority_queue 這種東西,但 C 的標準函式庫沒有,那是 C++ 的東西。 | |
這題的排序還得使用到 struct 跟指標這兩個東西,所以你們看看就好,看不懂我也不知道要怎麼辦……(這是基本的東西啊,雖然還沒教到……) | |
*/ | |
/* | |
題目要求的是 | |
出現次數越多的英文字母要越先輸出,次數相同時,字典順序較小的英文字母先輸出。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <ctype.h> | |
struct Node_ | |
{ | |
char c; | |
int cnt; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
long long get_reverse(long long a) { | |
long long rev = 0; | |
while (a != 0) { | |
rev = rev*10 + (a % 10); | |
a /= 10; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main() { | |
int N; | |
while (scanf("%d", &N) != EOF) { | |
int data[N]; | |
int i; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int max(const int a, const int b) { | |
return ((a > b) ? a : b); | |
} | |
int min(const int a, const int b) { | |
return ((a < b) ? a : b); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
long long abs_(long long a) { | |
return ((a < 0) ? -a: a); | |
} | |
int main() { | |
long long a, b; | |
while (scanf("%lld %lld", &a, &b) != EOF) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
int main() { | |
int N; | |
while (scanf("%d", &N)) { | |
if (N == 0) break; | |
int top = 1; | |
int front = 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
int main() { | |
long long N; | |
while (scanf("%lld", &N) != EOF) { | |
if (N <= 0) break; | |
if (N == 1) | |
printf("0%%\n"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() { | |
int N; | |
scanf("%d", &N); | |
while (N--) { | |
long long s, d; | |
scanf("%lld %lld", &s, &d); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main() { | |
int N; | |
scanf("%d", &N); | |
int data[N]; | |
memset(data, 0, sizeof(data)); |