Explorar o código

上传文件至 ''

Solitude %!s(int64=5) %!d(string=hai) anos
pai
achega
ff9a8035ad
Modificáronse 5 ficheiros con 104 adicións e 0 borrados
  1. 6 0
      A.cpp
  2. 28 0
      B.cpp
  3. 17 0
      C.cpp
  4. 33 0
      D.cpp
  5. 20 0
      E.cpp

+ 6 - 0
A.cpp

@@ -0,0 +1,6 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main(){
+    cout<<"Happy New Year \"2019\" !!!"<<endl;;
+    return 0;
+}

+ 28 - 0
B.cpp

@@ -0,0 +1,28 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main()
+{
+    int T;
+    cin>>T;
+    while(T--)
+    {
+        string s;
+        cin>>s;
+        int a[7];
+        memset(a,0,sizeof(a));
+        for(int i=0;i<s.size();i++)
+        {
+            if(tolower(s[i])=='l')a[0]++;
+            if(tolower(s[i])=='e')a[1]++;
+            if(tolower(s[i])=='a')a[2]++;
+            if(tolower(s[i])=='g')a[3]++;
+            if(tolower(s[i])=='u')a[4]++;
+            if(tolower(s[i])=='o')a[5]++;
+            if(tolower(s[i])=='f')a[6]++;
+        }
+       a[0]/=2;a[1]/=2;
+       sort(a,a+7);
+       cout<<a[0]<<endl;
+    }
+    return 0;
+}

+ 17 - 0
C.cpp

@@ -0,0 +1,17 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main()
+{
+    int T;
+    cin>>T;
+    while(T--)
+    {
+        int n;
+        cin>>n;
+        if(n%12==0) cout<<"YES"<<endl;
+        else if(n%4==0) cout<<"3"<<endl;
+        else if(n%6==0) cout<<"4"<<endl;
+        else cout<<"NO"<<endl;
+    }
+    return 0;
+}

+ 33 - 0
D.cpp

@@ -0,0 +1,33 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main()
+{
+    int n;
+    while(cin>>n && n)
+    {
+        double sum = 0;
+        if(n < 4) sum = 10;
+        if(n >= 4 && n <= 8) sum = 10 + (n - 4) * 2;
+        if(n > 8)
+        {
+            while(n >= 8)
+            {
+                sum += 18;
+                n -= 8;
+            }
+            if(n <= 4)
+            {
+                sum += 2.4 * n;
+            }
+            else
+            {
+                sum += 10 + (n - 4) * 2;
+            }
+        }
+        if(sum - (int)sum == 0)
+            printf("%d\n", (int)sum);  //注意这里输出格式的切换
+        else
+            printf("%.1f\n", sum);
+    }
+    return 0;
+}

+ 20 - 0
E.cpp

@@ -0,0 +1,20 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main()
+{
+    int x,sumz=0,tz=0,sumf=0,tf=0;
+    while (cin>>x && x)
+        if (x>0)
+        {
+            sumz+=x;
+            tz++;
+        }
+        else
+        {
+            sumf+=x;
+            tf++;
+        }
+    cout<<"Z:"<<tz<<"ge "<<sumz<<endl;
+    cout<<"F:"<<tf<<"ge "<<sumf<<endl;
+    return 0;
+}