zoukankan      html  css  js  c++  java
  • 杂项

    1. #include<stdio.h>
    2. #include<string.h>
    3. #include<map>
    4. #include<string>
    5. #include<iostream>
    6. #define weeks 5*8+2*4
    7. usingnamespace std;
    8. map<string,int>list;
    9. map<int, string>list1;
    10. int main()
    11. {
    12. list["Monday"]=1;
    13. list["Tuesday"]=2;
    14. list["Wednesday"]=3;
    15. list["Thursday"]=4;
    16. list["Friday"]=5;
    17. list["Saturday"]=6;
    18. list["Sunday"]=7;
    19. list1[1]="Monday";
    20. list1[2]="Tuesday";
    21. list1[3]="Wednesday";
    22. list1[4]="Thursday";
    23. list1[5]="Friday";
    24. list1[6]="Saturday";
    25. list1[7]="Sunday";
    26. char str[1000];
    27. int length;
    28. double speed;
    29. while(~scanf("%s%d%lf", str,&length,&speed))
    30. {
    31. string tp = str;
    32. double tep = length/speed;
    33. int weekday =0, weekend =0;
    34. if(list[tp]<=5) weekday =(5-list[tp]+1)*8+2*4;
    35. else weekday =(7-list[tp]+1)*4;
    36. if(tep > weekday+weekend)
    37. {
    38. tep-=weekday+weekend;
    39. tep =((tep/weeks)-int(tep)/weeks);
    40. tep *= weeks;
    41. tep =int(tep);
    42. cout << list1[tep]<< endl;
    43. }
    44. else
    45. {
    46. if(weekend ==0)
    47. cout << list1[list[tp]-int(weekday/]
    48. }
    49. }
    50. return0;
    51. }
    1. #include<stdio.h>
    2. #include<iostream>
    3. #include<string.h>
    4. #include<queue>
    5. usingnamespace std;
    6. int s[11000];
    7. int top;
    8. int main()
    9. {
    10. int t,n,m;
    11. scanf("%d",&t);
    12. while(t--)
    13. {
    14. top=1;
    15. s[top]=1;
    16. scanf("%d%d",&n,&m);
    17. for(int i=0;i<m;i++)
    18. {
    19. char tmp[10];
    20. scanf("%s",tmp);
    21. if(strcmp(tmp,"PRE")==0)
    22. {
    23. top--;
    24. if(top==0)
    25. {
    26. s[++top]=1;
    27. printf("%d ",s[top]);
    28. }
    29. else
    30. {
    31. printf("%d ",s[top]);
    32. }
    33. }
    34. else
    35. {
    36. if(strcmp(tmp,"NEXT")==0)
    37. {
    38. if(s[top]==n)// shi zuihou
    39. printf("%d ",n);
    40. else
    41. {
    42. int tt=s[top];
    43. printf("%d ",s[top]+1);
    44. s[++top]= tt+1;
    45. }
    46. }
    47. else
    48. {
    49. int key;
    50. scanf("%d",&key);
    51. if(key!=s[top])
    52. s[++top]=key;
    53. printf("%d ",key);
    54. }
    55. }
    56. }
    57. }
    58. return0;
    59. }
     





    附件列表

  • 相关阅读:
    BZOJ2762: [JLOI2011]不等式组
    BZOJ1452: [JSOI2009]Count
    Codeforces Round #441 (Div. 2, by Moscow Team Olympiad)
    BZOJ1635: [Usaco2007 Jan]Tallest Cow 最高的牛
    BZOJ2730: [HNOI2012]矿场搭建
    Flask实现异步非阻塞请求功能
    在flask中使用websocket-实时消息推送
    Python数据库连接池DBUtils
    flask请求上下文
    scanf与getchar
  • 原文地址:https://www.cnblogs.com/sober-reflection/p/9f3365768bbbebebbed8e1edc807100f.html
Copyright © 2011-2022 走看看