8 solutions

  • 9
    @ 2024-9-8 9:50:20
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n;
        cin>>n;
        int h=0,d=0;  //h表示以第i个小时结束的正常血压数目,d表示已有的最长的连续正常血压的数目 
        for(int i=1;i<=n;i++)
        {
            int b,s;
            cin>>b>>s;
            if((b>=90&&b<=140)&&(s>=60&&s<=90)) //当前正常 
            {
                h+=1; //在之前的基础上增加一个小时 
                if(h>d) //尝试更新一个小时 
                {
                    d=h;
                }
            }
            else  //不正常以后就清空正常的小时数 
            {
                h=0;
            }
        }
        cout<<d;
        return 0;
    }
    
    • 0
      @ 2025-9-21 15:46:17

      ***~~~^> - 1. - [ ] ````language 看什么看

      `^~~~*</u>**
      • 0
        @ 2025-8-6 14:39:15

        #include<bits/stdc++.h> using namespace std; int n; int main(){ cin>>n; int s,t; int cnt=0; int max=0; for(int i=1;i<=n;i++){ cin>>s>>t; if(s>=90&&s<=140&&t>=60&&t<=90){ cnt++; if(cnt>max){ max=cnt; } }else{ cnt=0; } } cout<<max;

        return 0;
        

        }

        • -1
          @ 2024-7-12 11:49:30
          #include<bits/stdc++.h>
          using namespace std;
          int main()
          {
              int n,cut=0,t=0,c=0;
              cin>>n;
              for(int i=0;i<=n;i++)
              {
                  int x,y;
                  cin>>x>>y;
                  if(x>=90 && x<=140 && y>=60 && y<=90)
                  {
                      cut++;
                  }
                  else
                  {
                      c=1;
                      if(cut>=t)
                      {
                          t=cut;
                          cut=0;
                      }
                      else
                      {
                          cut=0;
                      }
                  }
              }
              if(c==0)
              {
                  cout<<cut-1;
              }
              else
              {
                  cout<<t;
              }
          }
          
          • -2
            @ 2024-10-20 11:26:08
            #include<bits/stdc++.h>
            using namespace std;
            int main()
            {
            	int n;
            	cin>>n;
            	int h=0,d=0;
            	for(int i=1;i<=n;i++)
            {
            	int b,s;
            	cin>>b>>s;
            	
            	if((b>=90&&b<=140)&&(s>=60&&s<=90))	
            	{
            		h+=1;
            		if(h>d){
            			d=h;
            		} 
            	}
            	else
            	{
            		h=0;
            	}
            } 
            cout<<d;	
            	return 0;
            }
            
            • -4
              @ 2024-10-20 15:18:32

              #include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int h=0,d=0; //h表示以第i个小时结束的正常血压数目,d表示已有的最长的连续正常血压的数目 for(int i=1;i<=n;i++) { int b,s; cin>>b>>s; if((b>=90&&b<=140)&&(s>=60&&s<=90)) //当前正常 { h+=1; //在之前的基础上增加一个小时 if(h>d) //尝试更新一个小时 { d=h; } } else //不正常以后就清空正常的小时数 { h=0; } } cout<<d; return 0; }

              • -4
                @ 2024-10-20 11:27:32
                using namespace std;
                int main()
                {
                	int n;
                	cin>>n;
                	int maxv=0,h=0;
                	//maxv表示当前已有的连续正常血压的最长小时数,h表示以第i个小时结尾的连续正常血压小时数目
                	for(int i=1;i<=n;i++)
                	{
                		int a,b;
                		cin>>a>>b;
                		if(a>=90&&a<=140&&b>=60&&b<=90)
                		{
                			h++;	
                		}	
                		else
                		{
                			h=0;
                		}
                		if(h>maxv) //以第i个小时结尾的连续正常血压数已经高于已有最大值 
                		{
                			maxv=h;
                		}
                	} 
                	cout<<maxv;
                	return 0;
                }
                
                
                • -6
                  @ 2024-7-11 9:16:09

                  1+1=2

                  • 1

                  Information

                  ID
                  881
                  Time
                  1000ms
                  Memory
                  256MiB
                  Difficulty
                  1
                  Tags
                  (None)
                  # Submissions
                  234
                  Accepted
                  67
                  Uploaded By