zoukankan      html  css  js  c++  java
  • Comet OJ

    同样的补题 (补题补的我想去玩pokemmo还有重推pokemon了

    A题 第001话 宝可梦,就决定是你了!

    简单的数学问题 一个公式的问题

    AC代码:

     1 #include<bits/stdc++.h>
     2 #define pi acos(-1)
     3 typedef long long ll;
     4 typedef unsigned long long ull;
     5 using namespace std;
     6 
     7 namespace io {
     8     const int SIZE = 1e7 + 10;
     9     char inbuff[SIZE];
    10     char *l, *r;
    11     inline void init() {
    12         l = inbuff;
    13         r = inbuff + fread(inbuff, 1, SIZE, stdin);
    14     }
    15     inline char gc() {
    16         if (l == r) init();
    17         return (l != r) ? *(l++) : EOF;
    18     }
    19     void read(int &x) {
    20         x = 0; char ch = gc();
    21         while(!isdigit(ch)) ch = gc();
    22         while(isdigit(ch)) x = x * 10 + ch - '0', ch = gc();
    23     }
    24 } using io::read;
    25 
    26 bool cmp(const int &a, const int &b){
    27     return a > b;
    28 }
    29 
    30 int main(){
    31     ios::sync_with_stdio(false);
    32     ll n;
    33     cin>>n;
    34     cout<<n * n<<endl;
    35     return 0;
    36 }

    C题 第003话 收服宝可梦吧!

     

    贪心就好啦

    AC代码:

     1 #include<bits/stdc++.h>
     2 #define pi acos(-1)
     3 typedef long long ll;
     4 typedef unsigned long long ull;
     5 using namespace std;
     6 
     7 namespace io {
     8     const int SIZE = 1e7 + 10;
     9     char inbuff[SIZE];
    10     char *l, *r;
    11     inline void init() {
    12         l = inbuff;
    13         r = inbuff + fread(inbuff, 1, SIZE, stdin);
    14     }
    15     inline char gc() {
    16         if (l == r) init();
    17         return (l != r) ? *(l++) : EOF;
    18     }
    19     void read(int &x) {
    20         x = 0; char ch = gc();
    21         while(!isdigit(ch)) ch = gc();
    22         while(isdigit(ch)) x = x * 10 + ch - '0', ch = gc();
    23     }
    24 } using io::read;
    25 
    26 bool cmp(const int &a, const int &b){
    27     return a > b;
    28 }
    29 
    30 int main(){
    31     ios::sync_with_stdio(false);
    32     int n;
    33     cin>>n;
    34     int cnt;
    35     while (n--){
    36         char s[1000005], t[1000005];
    37         cin>>s>>t;
    38         cnt = 0;
    39         int len1 = strlen(s);
    40         int len2 = strlen(t);
    41         if (len1 != len2 + 2){
    42             cout<<0<<endl;
    43             continue;
    44         }
    45         for (int i = 0; i < len1; i++)
    46             if (s[i] == t[cnt]) cnt++;
    47         if (cnt == len2) cout<<1<<endl;
    48         else cout<<0<<endl;
    49     }
    50     return 0;
    51 }

    D题 第004话 武士少年的挑战!

     

    就是每年过年时玩的一种抽牌游戏 排序之后判断一下就行了

    AC代码:

     1 #include<bits/stdc++.h>
     2 #define pi acos(-1)
     3 typedef long long ll;
     4 typedef unsigned long long ull;
     5 using namespace std;
     6 
     7 namespace io {
     8     const int SIZE = 1e7 + 10;
     9     char inbuff[SIZE];
    10     char *l, *r;
    11     inline void init() {
    12         l = inbuff;
    13         r = inbuff + fread(inbuff, 1, SIZE, stdin);
    14     }
    15     inline char gc() {
    16         if (l == r) init();
    17         return (l != r) ? *(l++) : EOF;
    18     }
    19     void read(int &x) {
    20         x = 0; char ch = gc();
    21         while(!isdigit(ch)) ch = gc();
    22         while(isdigit(ch)) x = x * 10 + ch - '0', ch = gc();
    23     }
    24 } using io::read;
    25 
    26 bool cmp(const int &a, const int &b){
    27     return a > b;
    28 }
    29 
    30 int main(){
    31     ios::sync_with_stdio(false);
    32     int a[18];
    33     for (int i = 0; i < 18; i++) cin>>a[i];
    34     sort(a, a + 18);
    35     int cnt = 0;
    36     for (int i = 0; i < 17; i++){
    37         if (a[i] == 0) continue;
    38         if (a[i] == a[i + 1]){
    39             cnt++;
    40             i++;
    41         }
    42     }
    43     cout<<18 - cnt * 2<<endl;
    44     return 0;
    45 }
  • 相关阅读:
    DataTableToJSON
    css hack
    把网络数据流转换成图片类
    递归(转)
    SQL 锁
    观察者
    yield
    开闭原则(转)
    迪米特法则(最少知道原则)(转)
    sql 游标
  • 原文地址:https://www.cnblogs.com/Misuchii/p/10969484.html
Copyright © 2011-2022 走看看