个人简单题解

  1. Chord

题目大意是有12个符号,多个循环在一块。任意给三个,他们之间距离如果为3.4就为minor triad chord或者4.3就为a major triad chord.其余均为Dissonance。

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int i,j;
  4. string res[3];
  5. string b[]={"C","C#","D","D#","E","F","F#","G","G#","A","A#","B","C","C#","D","D#","E","F","F#","G","G#","A","A#","B"};
  6. int show(string x,string y){
  7. int a=0,d=0,c=0;
  8. for(i=0;i<24;i++){
  9.      if(x==b[i]){
  10.         for(j=i;j<24;j++){
  11.             if(y==b[j]){
  12.                int tol=j-i;
  13.                return tol;
  14.                break;
  15.             }
  16.         }
  17.      }
  18. }
  19. }
  20.  
  21. int main(){
  22. int r,n,m;
  23. cin>>r;
  24. while(r--){
  25. for(j=0;j<3;j++)cin>>res[j];
  26. n=show(res[0],res[1]);
  27. m=show(res[1],res[2]);
  28. if(n==4&&m==3)printf("Major triad\n");
  29. else if(n==3&&m==4)printf("Minor triad\n");
  30. else printf("Dissonance\n");
  31. }
  32. return 0;
  33. }

L. Swimmer

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int n, k;
  4. string a[1010];
  5. int b[1010];
  6. int main(){
  7. int t;
  8. cin >> t;
  9.        while( t -- ){
  10.                cin >> n >> k;
  11.               
  12.                memset(b, 0, sizeof(b));
  13.                for(int j = 0; j < n; j ++)                  
  14.                cin >> a[j];
  15.               
  16.                for(int i = 0; i < n; i ++){
  17.                        for(int j = 0; j < a[i].size(); j ++){
  18.                               if(a[i][j] >= '0' && a[i][j] <= '9'){
  19.                                       b[i] *= 10;
  20.                                       b[i] += a[i][j] - '0';
  21.                               }
  22.                        }
  23.                       
  24.                }
  25.               
  26.                sort(b, b + n);
  27.                for(int i = 0; i < k; i ++)cout << b[i] << " ";
  28.                cout << endl;
  29.        }
  30.       
  31.        return 0;
  32. }

G. Matrix

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef long long LL;
  5. long long a, b;
  6. LL binary_search(LL a)
  7. {
  8.     LL l = 1, r = 1e9;
  9.     while(l < r)
  10.     {
  11.         LL mid = l + r + 1  >> 1;
  12.         if(mid * mid <= a) l = mid;
  13.         else r = mid - 1;
  14.     }
  15.     return l;
  16. }
  17. void solve(){   
  18.     cin >> a >> b;
  19.    cout << binary_search(a) * binary_search(b) << endl;
  20. }
  21. int main()
  22. {
  23.     int _ = 1;
  24.     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  25.     cin >> _;
  26.     while(_ -- ){
  27.         solve();
  28.     }
  29.     return 0;
  30. }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值