GVKun编程网logo

CG软件调研 The Foundry旗下的HIERO(cg软件是干什么的)

11

此处将为大家介绍关于CG软件调研TheFoundry旗下的HIERO的详细内容,并且为您解答有关cg软件是干什么的的相关问题,此外,我们还将为您介绍关于3DCG软件blender入门教程、?NotFo

此处将为大家介绍关于CG软件调研 The Foundry旗下的HIERO的详细内容,并且为您解答有关cg软件是干什么的的相关问题,此外,我们还将为您介绍关于3D CG软件blender入门教程、?Not Found The requested URL /www/index.php was not found on this server.解决办法、Basic overview of the country''s highest、cf 1063D Round 516 Candies for Children的有用信息。

本文目录一览:

CG软件调研 The Foundry旗下的HIERO(cg软件是干什么的)

CG软件调研 The Foundry旗下的HIERO(cg软件是干什么的)

#HIERO介绍
The Foundry官网
HIERO官网
HIERO
HIERO将会给你一站式的镜头管理,正确性与审查的解决方案,以平滑方式支持协作并快速回退和传递。

#安装HIERO 略

#分析HIERO的导入导出 参考手册和自己测试,确定HIERO对外导入导出工程有三种方式:HIERO工程文件、EDL文件、Final Cut 7 Pro XML文件。

##Final Cut 7 Pro XML 编者载入了1个片段,并简单剪辑后,使用HIERO导出XML文件。如下是重要的代码片段。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xmeml>
<xmeml version="5">
  <sequence id="Sequence 2">
  ...
  </sequence>
</xmeml>

首先先确定了导出Sequence的XML文件能够满足当前开发需求,其后观察所导出的XML文件内容。
其次同时在查找Final Cut 7 Pro XML相关的库和代码。
通过搜索引擎,查找到Python具备Final Cut 7 Pro XML的代码库xmeml。GitHub xmeml地址

再次重新对比惊奇的发现HIERO导出的Final Cut 7 Pro XML文件的文件内容标识竟然含有xmeml标识,由于xmeml库本身已经6年未更新(最后一次更新为2010年),则有两种可能,一种是The Foundry公司导出Final Cut 7 Pro XML使用的就是GitHub上的代码,另外一种可能,是雇佣了xmeml项目的作者。

通过调试xmeml代码,对github上的测试进行输出,来确定xmeml的版本,测试代码如下:

from xmeml import VideoSequence

v2 = VideoSequence(file=''examples/Mark P XML.xml'')

clip2 = v2.clip(300, 500, units=''seconds'')

xmldom2,dumb_uuid = v2.clips2dom([clip2])

print xmldom2.toxml()

file = open(''example_1.xml'',mode=''w'')
file.write(xmldom2.toxml())
file.close()

发现输出的xmeml输出的xml文件版本为4,输出xml片段如下:

<?xml version="1.0" ?>
<xmeml version="4">
  <sequence>
  ...
  </sequence>
</xmeml>

~~则能够确定HIREO雇佣或者向xmeml作者购买了代码内容。~~由于查询了下面的内容,法线xmeml为苹果公司的规定,而不是某个人的规则
通过搜索查询到What is Final Cut Pro XML (Part Two): Compatibility作为参考

#调查结果 ##Final Cut 7 Pro XML 通过阅读What is Final Cut Pro XML (Part Two): Compatibility,查找到了Final Cut 7 Pro XML的定义文档。
Versions of XMEML and Final Cut是Final Cut 7 Pro的文档,而About Final Cut Pro X XML Version 1.5是当前使用的Final Cut X的XML文件解析。 #完整代码 ##HIERO导出的Final Cut 7 Pro XML文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xmeml>
<xmeml version="5">
  <sequence id="Sequence 2">
    <name>中文测试Sequence 2</name>
    <duration>3193</duration>
    <rate>
      <ntsc>FALSE</ntsc>
      <timebase>24</timebase>
    </rate>
    <timecode>
      <rate>
        <ntsc>FALSE</ntsc>
        <timebase>24</timebase>
      </rate>
      <frame>86400</frame>
      <displayformat>NDF</displayformat>
      <string>01:00:00:00</string>
    </timecode>
    <media>
      <video>
        <format>
          <samplecharacteristics>
            <width>1920</width>
            <height>1080</height>
            <rate>
              <ntsc>FALSE</ntsc>
              <timebase>24</timebase>
            </rate>
          </samplecharacteristics>
        </format>
        <track>
          <name>Video 4</name>
          <clipitem>
            <name>Source</name>
            <duration>2879</duration>
            <rate>
              <ntsc>FALSE</ntsc>
              <timebase>24</timebase>
            </rate>
            <enabled>TRUE</enabled>
            <in>0.0</in>
            <out>2879.0</out>
            <start>314</start>
            <end>3193</end>
            <file id="Source">
              <name>Source</name>
              <pathurl>file://localhost/D:/ZhanPeng/Source/20130827.mov</pathurl>
              <duration>2879</duration>
              <rate>
                <ntsc>FALSE</ntsc>
                <timebase>24</timebase>
              </rate>
              <width>1920</width>
              <height>1080</height>
              <media>
                <video>
                  <duration>2879</duration>
                  <samplecharacteristics>
                    <width>1920</width>
                    <height>1080</height>
                  </samplecharacteristics>
                </video>
                <audio>
                  <channelcount>2</channelcount>
                  <samplecharacteristics>
                    <depth>16</depth>
                    <samplerate>48000</samplerate>
                  </samplecharacteristics>
                </audio>
              </media>
              <timecode>
                <rate>
                  <ntsc>FALSE</ntsc>
                  <timebase>24</timebase>
                </rate>
                <frame>0</frame>
                <displayformat>NDF</displayformat>
                <string>00:00:00:00</string>
              </timecode>
            </file>
          </clipitem>
        </track>
        <track>
          <name>Video 1</name>
          <clipitem>
            <name>Source</name>
            <duration>2879</duration>
            <rate>
              <ntsc>FALSE</ntsc>
              <timebase>24</timebase>
            </rate>
            <enabled>TRUE</enabled>
            <in>0.0</in>
            <out>244.0</out>
            <start>70</start>
            <end>314</end>
            <file id="Source">
              <name>Source</name>
              <pathurl>file://localhost/D:/ZhanPeng/Source/20130827.mov</pathurl>
              <duration>2879</duration>
              <rate>
                <ntsc>FALSE</ntsc>
                <timebase>24</timebase>
              </rate>
              <width>1920</width>
              <height>1080</height>
              <media>
                <video>
                  <duration>2879</duration>
                  <samplecharacteristics>
                    <width>1920</width>
                    <height>1080</height>
                  </samplecharacteristics>
                </video>
                <audio>
                  <channelcount>2</channelcount>
                  <samplecharacteristics>
                    <depth>16</depth>
                    <samplerate>48000</samplerate>
                  </samplecharacteristics>
                </audio>
              </media>
              <timecode>
                <rate>
                  <ntsc>FALSE</ntsc>
                  <timebase>24</timebase>
                </rate>
                <frame>0</frame>
                <displayformat>NDF</displayformat>
                <string>00:00:00:00</string>
              </timecode>
            </file>
          </clipitem>
        </track>
      </video>
      <audio>
        <format>
          <samplecharacteristics>
            <depth>16</depth>
            <samplerate>48000</samplerate>
          </samplecharacteristics>
        </format>
        <track>
          <name>Audio 4</name>
          <clipitem>
            <name>Source</name>
            <duration>2879</duration>
            <rate>
              <ntsc>FALSE</ntsc>
              <timebase>24</timebase>
            </rate>
            <enabled>TRUE</enabled>
            <in>0.0</in>
            <out>2879.0</out>
            <start>314</start>
            <end>3193</end>
            <file id="Source">
              <name>Source</name>
              <pathurl>file://localhost/D:/ZhanPeng/Source/20130827.mov</pathurl>
              <duration>2879</duration>
              <rate>
                <ntsc>FALSE</ntsc>
                <timebase>24</timebase>
              </rate>
              <width>1920</width>
              <height>1080</height>
              <media>
                <video>
                  <duration>2879</duration>
                  <samplecharacteristics>
                    <width>1920</width>
                    <height>1080</height>
                  </samplecharacteristics>
                </video>
                <audio>
                  <channelcount>2</channelcount>
                  <samplecharacteristics>
                    <depth>16</depth>
                    <samplerate>48000</samplerate>
                  </samplecharacteristics>
                </audio>
              </media>
              <timecode>
                <rate>
                  <ntsc>FALSE</ntsc>
                  <timebase>24</timebase>
                </rate>
                <frame>0</frame>
                <displayformat>NDF</displayformat>
                <string>00:00:00:00</string>
              </timecode>
            </file>
          </clipitem>
        </track>
        <track>
          <name>Audio 1</name>
          <clipitem>
            <name>Source</name>
            <duration>2879</duration>
            <rate>
              <ntsc>FALSE</ntsc>
              <timebase>24</timebase>
            </rate>
            <enabled>TRUE</enabled>
            <in>0.0</in>
            <out>244.0</out>
            <start>70</start>
            <end>314</end>
            <file id="Source">
              <name>Source</name>
              <pathurl>file://localhost/D:/ZhanPeng/Source/20130827.mov</pathurl>
              <duration>2879</duration>
              <rate>
                <ntsc>FALSE</ntsc>
                <timebase>24</timebase>
              </rate>
              <width>1920</width>
              <height>1080</height>
              <media>
                <video>
                  <duration>2879</duration>
                  <samplecharacteristics>
                    <width>1920</width>
                    <height>1080</height>
                  </samplecharacteristics>
                </video>
                <audio>
                  <channelcount>2</channelcount>
                  <samplecharacteristics>
                    <depth>16</depth>
                    <samplerate>48000</samplerate>
                  </samplecharacteristics>
                </audio>
              </media>
              <timecode>
                <rate>
                  <ntsc>FALSE</ntsc>
                  <timebase>24</timebase>
                </rate>
                <frame>0</frame>
                <displayformat>NDF</displayformat>
                <string>00:00:00:00</string>
              </timecode>
            </file>
          </clipitem>
        </track>
      </audio>
    </media>
  </sequence>
</xmeml>

#附录

##201161206多序列帧XML文件格式

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xmeml>
<xmeml version="5">
    <sequence>
        <name>Timeline 1 (Resolve)</name>
        <duration>137</duration>
        <rate>
            <timebase>24</timebase>
            <ntsc>false</ntsc>
        </rate>
        <in>-1</in>
        <out>-1</out>
        <timecode>
            <string>01:00:00:00</string>
            <frame>86400</frame>
            <displayformat>NDF</displayformat>
            <rate>
                <timebase>24</timebase>
                <ntsc>false</ntsc>
            </rate>
        </timecode>
        <media>
            <video>
                <track>
                    <clipitem id="未命名[00086414-00086550].dpx 0">
                        <name>未命名[00086414-00086550].dpx</name>
                        <duration>137</duration>
                        <rate>
                            <timebase>24</timebase>
                            <ntsc>false</ntsc>
                        </rate>
                        <start>0</start>
                        <end>137</end>
                        <enabled>true</enabled>
                        <in>0</in>
                        <out>137</out>
                        <file id="未命名[00086414-00086550].dpx 2">
                            <duration>137</duration>
                            <rate>
                                <timebase>24</timebase>
                                <ntsc>false</ntsc>
                            </rate>
                            <name>未命名[00086414-00086550].dpx</name>
                            <pathurl>file://localhost/D:/ZhanPeng/Render/%E6%9C%AA%E5%91%BD%E5%90%8D[00086414-00086550].dpx</pathurl>
                            <timecode>
                                <string>01:00:00:14</string>
                                <displayformat>NDF</displayformat>
                                <rate>
                                    <timebase>24</timebase>
                                    <ntsc>false</ntsc>
                                </rate>
                            </timecode>
                            <media>
                                <video>
                                    <duration>137</duration>
                                    <samplecharacteristics>
                                        <width>1920</width>
                                        <height>1080</height>
                                    </samplecharacteristics>
                                </video>
                            </media>
                        </file>
                        <compositemode>normal</compositemode>
                        <filter>
                            <enabled>true</enabled>
                            <start>0</start>
                            <end>137</end>
                            <effect>
                                <name>Opacity</name>
                                <effectid>opacity</effectid>
                                <effecttype>motion</effecttype>
                                <mediatype>video</mediatype>
                                <effectcategory>motion</effectcategory>
                                <parameter>
                                    <name>opacity</name>
                                    <parameterid>opacity</parameterid>
                                    <value>100</value>
                                    <valuemin>0</valuemin>
                                    <valuemax>100</valuemax>
                                </parameter>
                            </effect>
                        </filter>
                        <filter>
                            <enabled>true</enabled>
                            <start>0</start>
                            <end>137</end>
                            <effect>
                                <name>Basic Motion</name>
                                <effectid>basic</effectid>
                                <effecttype>motion</effecttype>
                                <mediatype>video</mediatype>
                                <effectcategory>motion</effectcategory>
                                <parameter>
                                    <name>Scale</name>
                                    <parameterid>scale</parameterid>
                                    <value>100</value>
                                    <valuemin>0</valuemin>
                                    <valuemax>10000</valuemax>
                                </parameter>
                                <parameter>
                                    <name>Center</name>
                                    <parameterid>center</parameterid>
                                    <value>
                                        <horiz>0</horiz>
                                        <vert>0</vert>
                                    </value>
                                </parameter>
                                <parameter>
                                    <name>Rotation</name>
                                    <parameterid>rotation</parameterid>
                                    <value>0</value>
                                    <valuemin>-100000</valuemin>
                                    <valuemax>100000</valuemax>
                                </parameter>
                                <parameter>
                                    <name>Anchor Point</name>
                                    <parameterid>centerOffset</parameterid>
                                    <value>
                                        <horiz>0</horiz>
                                        <vert>0</vert>
                                    </value>
                                </parameter>
                            </effect>
                        </filter>
                        <filter>
                            <enabled>true</enabled>
                            <start>0</start>
                            <end>137</end>
                            <effect>
                                <name>Crop</name>
                                <effectid>crop</effectid>
                                <effecttype>motion</effecttype>
                                <mediatype>video</mediatype>
                                <effectcategory>motion</effectcategory>
                                <parameter>
                                    <name>left</name>
                                    <parameterid>left</parameterid>
                                    <value>0</value>
                                    <valuemin>0</valuemin>
                                    <valuemax>100</valuemax>
                                </parameter>
                                <parameter>
                                    <name>right</name>
                                    <parameterid>right</parameterid>
                                    <value>0</value>
                                    <valuemin>0</valuemin>
                                    <valuemax>100</valuemax>
                                </parameter>
                                <parameter>
                                    <name>top</name>
                                    <parameterid>top</parameterid>
                                    <value>0</value>
                                    <valuemin>0</valuemin>
                                    <valuemax>100</valuemax>
                                </parameter>
                                <parameter>
                                    <name>bottom</name>
                                    <parameterid>bottom</parameterid>
                                    <value>0</value>
                                    <valuemin>0</valuemin>
                                    <valuemax>100</valuemax>
                                </parameter>
                            </effect>
                        </filter>
                    </clipitem>
                    <enabled>true</enabled>
                    <locked>false</locked>
                </track>
                <format>
                    <samplecharacteristics>
                        <width>1920</width>
                        <height>1080</height>
                        <pixelaspectratio>square</pixelaspectratio>
                        <rate>
                            <timebase>24</timebase>
                            <ntsc>false</ntsc>
                        </rate>
                        <codec>
                            <appspecificdata>
                                <appname>Final Cut Pro</appname>
                                <appmanufacturer>Apple Inc.</appmanufacturer>
                                <data>
                                    <qtcodec/>
                                </data>
                            </appspecificdata>
                        </codec>
                    </samplecharacteristics>
                </format>
            </video>
            <audio>
                <track>
                    <enabled>true</enabled>
                    <locked>false</locked>
                </track>
            </audio>
        </media>
    </sequence>
</xmeml>

3D CG软件blender入门教程

3D CG软件blender入门教程

大家知道这个名为“blender”的软件吗?

做设计或者影像相关工作的人,以及对这个方面有兴趣的人,想必都听说过这个软件吧!

blender是主要以建模和影像编辑来制作3DCG的软件。也就是使用通过自己制作的模型来制作影像作品。这个软件从几年前开始普及,在日本也经常会用在二次创作或者Fab上面。并且它和游戏开发软件“Unity”之间的联系也非常多。因此,这样的文章似乎显得有点迟,但是从目前来看,3DCG的制作技术已经有了一个长足的进步,所以我觉得非常有必要重新认识一下这个软件。

从这点来说,blender最好的部分就是在于——功能多到完全不会觉得这是个免费软件。

首先,blender最大的特征可以说是完全免费这一点了。相信有很多人在提起3DCG制作软件时,第一印象都会觉得其价格非常的昂贵。比如在3DCG制作软件中具有代表意义的MAYA或者MAX,这些专业制作软件的价格就达到了70万~80万日元(4万多RMB)。

就算是稍微便宜一些的软件一般都需要数十万日元。也存在类似blender这样的免费软件,但是这些软件往往不是机能有所限制就是单纯的质量低下。在这些免费的软件中,blender已经可以和那些高性能3D软件比肩了。

并且,由于其是一款开源的软件,所以会因为全世界开发者的努力而让其不断的进化,非常的厉害。一、blender的初步认识我们启动blender后,画像就会像上图一样,在画面中配置了光源、镜头以及立方体。想必有不少人这个时候会尝试对这个立方体做些什么。但左键点击也只会出现一个小菜单,并不能触碰到立方体。3D软件中有很多都采用了特殊的UI。它们可能会和PC或者adobe相关的产品操作完全不同。下面会为大家解说,在使用blender时我们需要知道的一些操作。右键为选择、左键为确定、移动为G。其它的软件可能在选择后可以直接移动,但是在blender中,我们需要在选择的状态中按下G键。

图片
A为全选择,再按一次解除。想要重置选择的时候可以使用这个指令。
图片
消除对象为X。如果习惯使用photoshop等软件,很多人都会按DELITE吧(图片为object模式的情况)。shift+A来追加网孔。可以追加新的对象。顺带一提,鼠标操作以及指令都是可以自定义的。如果有需要的话可以在File → User Preferences或者ctrl+alt+U打开用户偏好来进行设定。打开用户偏好,点击input后点击选择图片部分的复选框。
图片

二、3DCG基础知识3DCG制作的过程主要为下面这个过程,但是也存在步骤调换的情况。建模(形成)素材的设定质感的贴图动作设定场景(光源和镜头)的设定渲染(摄影)三、建模3D对象根据顶点(Vertices)、边(edge)、面(face)这个3个要素来成立的。

根据顶点互相连接而关闭的地方会设定为面,而这个过程我们称之为建模。然后在blender中制作的时候,object模式和edit模式可以使用tab键来进行切换。object模式在这个模式下,我们可以让对象单位进行移动、旋转、扩大缩小等操作。edit模式对对象的形状进行细致编辑的模式。基本以基顶点(Vertices)、边(edge)、面(face)3个要素来进行。基本的理解为使用edit模式来形成对象→object模式来对对象的核心进行编辑和确定(位置和大小)。建模的第一步那么,让我们实际的使用一下edit模式吧!我们看到窗口的下面,通过橙色框来进行模式的确认。然后通过黄色框的地方来确定顶点(Vertices)、边(edge)、面(face)之中,我们移动的是哪个。

图片
编辑要素的icon从左开始是顶点(Vertices)、边(edge)、面(face)。尝试移动吧!
图片
顶点
图片

图片

面四、总结在这里对选择的象进行移动、成型的基础想必大家都有一定的理解了。这次对3D CG软件blender的讲解算是非常入门的东西,后面的文章我将会慢慢为大家带来更加深入的介绍以及实践。

?Not Found The requested URL /www/index.php was not found on this server.解决办法

?Not Found The requested URL /www/index.php was not found on this server.解决办法

?Not Found The requested URL /www/index.php was not found on this server.
电脑是WAMP环境的,我之前不小心删了NetBeans,重新下载后运行文件就出现Not Found

The requested URL /www/index.php was not found on this server.
是不是要在WAMPWERVER里面配置?我什么都不懂,请诉说的详细一点。
------解决思路----------------------
没有www吧。去掉www访问试试看。
------解决思路----------------------
apache中的httpd.conf
DocumentRoot "E:/wamp/www/"
看看你的localhost域名配置的文件夹是什么,这个文件夹下没有www/index.php文件
------解决思路----------------------
找不到这文件啊,看看你的根目录下有没有这文件

Basic overview of the country''s highest

Basic overview of the country''s highest

Basic overview of the country''s highest

scholarship amount of Marker Pen 8000 yuan; nationalmotivational scholarships 5000. 1, the Chinese media player Government Scholarship is divided into full scholarship and partial scholarship. 2, the internet tv box Chinese government full scholarship as follows: Exempt from registration fee, tuition, laboratory fees, internship, fee for basic learning materials and accommodation hdd media player ; provide China Public health services equivalent students; providing scholarships android tv box and living off settlement subsidy; provide admission to the school by the city port of entry where the city City smart tv box, Chinese tutoring institutions city to city professional colleges and graduate schools to the exit port city where the city''s train hard seat ticket ( Take the overnight sleeper train ticket when); principles of international travel scholarship students shall be borne by the sending. Otherwise agreed by the agreement provisions. 3, living expenses and one-time scholarships resettlement allowance, specific criteria are as follows: Undergraduate Scholarship living: 800 yuan per person per month digital signs Master of Research Scholarship living: 1,100 yuan per month living expenses PhD Fellowship digital advertising: 1,400 yuan per person per month Chinese language students Scholarships Golden Living Expenses: 800 yuan per person per month (with a graduate degree or above 1,100 yuan per person per month) General Scholar Scholarship living : 1,100 yuan per person per month living allowance Senior Scholar: 1,400 yuan per person per month of the study period full of all kinds of scholarship students An academic pos display who, when given a one-time enrollment fee of 600 yuan resettlement; study period were less than a year, sent off settlement subsidy enrollment Fee 300 yuan. Wall General Scholar scholarships and full scholarships or senior scholars treated the same. Outstanding student scholarships and full scholarships or graduate PhD Fellowship same treatment. HSK Winner Scholarship: Chinese language students with full Scholarships same treatment. Chinese Culture Research: Exempt from registration fee, research, accommodation and emergency medical expenses, research grants given another monthly fee 3,000 yuan, to provide a one-time fee of 750 yuan books and scholarly travel subsidy 1,000 yuan. Short-term study of foreign language teachers Revised Project: Exempt from digital signage registration fee, tuition, accommodation and emergency medical expenses, provide a one-time fee of 2,000 yuan living allowance; participate in collective teaching trip Walker exempted from lodging and transportation costs, and the other to provide 650 yuan subsidy for meals. The Chinese government will be adjusted from time scholarship criteria, the specific circumstances See CSC printed by the "Chinese Government Scholarship Students Admissions Guide" [1]. Somelocalgovernments and schools also have a foreign student award Scholarship. Specific situation, please directly to the local governments and universities queries. Category Chinese Government Scholarship students divided into categories according to undergraduate scholarships, graduate fellowships, PhD Fellowship, Chinese feed Seminarians scholarships, general scholars and senior scholars scholarships, in addition to the Great Wall by the project is divided into scholarships, honors student scholarships, HSK Winner Those scholarships, foreign teachers to teach English overseas short-term training programs and research projects of Chinese culture. Fellowships 2014 fall semester, will graduate scholarships adjusted to normal state grants, an annual subsidy of not less than 10,000 students do not Less than 6,000 yuan; also set up graduate studies scholarship. [1] to increase the graduate teaching hdd player assistants, research assistants, and help control post allowance funding efforts. Improve the national student Loan ceiling. Implement and improve preferential policies to encourage To apply to the Chinese University to pursue a bachelor''s degree to provide for a period is usually 4 year (the medical profession as the five year). Applicants should have the equivalent of China''s high- Grade high school scholastic ability, academic excellence, and through the Chinese university entrance or by recommendation and Chinese universities without taking an examination, the age of scholarship Scholarships (18) 25 years of age. Master To apply to the Chinese University to pursue a master''s degree provides, 2-3 academic years. Applicants should have a bachelor''s degree, academic excellence, outside China Applicants are required to have two professors or associate professors in Chinese

cf 1063D Round 516 Candies for Children

cf 1063D Round 516 Candies for Children

D. Candies for Children
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

At the children''s festival, children were dancing in a circle. When music stopped playing, the children were still standing in a circle. Then Lena remembered, that her parents gave her a candy box with exactly kk candies "Wilky May". Lena is not a greedy person, so she decided to present all her candies to her friends in the circle. Lena knows, that some of her friends have a sweet tooth and others do not. Sweet tooth takes out of the box two candies, if the box has at least two candies, and otherwise takes one. The rest of Lena''s friends always take exactly one candy from the box.

Before starting to give candies, Lena step out of the circle, after that there were exactly nn people remaining there. Lena numbered her friends in a clockwise order with positive integers starting with 11 in such a way that index 11 was assigned to her best friend Roma.

Initially, Lena gave the box to the friend with number ll, after that each friend (starting from friend number ll) took candies from the box and passed the box to the next friend in clockwise order. The process ended with the friend number rr taking the last candy (or two, who knows) and the empty box. Please note that it is possible that some of Lena''s friends took candy from the box several times, that is, the box could have gone several full circles before becoming empty.

Lena does not know which of her friends have a sweet tooth, but she is interested in the maximum possible number of friends that can have a sweet tooth. If the situation could not happen, and Lena have been proved wrong in her observations, please tell her about this.

Input

The only line contains four integers nn, ll, rr and kk (1n,k10111≤n,k≤1011, 1l,rn1≤l,r≤n) — the number of children in the circle, the number of friend, who was given a box with candies, the number of friend, who has taken last candy and the initial number of candies in the box respectively.

Output

Print exactly one integer — the maximum possible number of sweet tooth among the friends of Lena or "-1" (quotes for clarity), if Lena is wrong.

Examples
input
Copy
4 1 4 12
output
Copy
2
input
Copy
5 3 4 10
output
Copy
3
input
Copy
10 5 5 1
output
Copy
10
input
Copy
5 4 5 6
output
Copy
-1
Note

In the first example, any two friends can be sweet tooths, this way each person will receive the box with candies twice and the last person to take sweets will be the fourth friend.

In the second example, sweet tooths can be any three friends, except for the friend on the third position.

In the third example, only one friend will take candy, but he can still be a sweet tooth, but just not being able to take two candies. All other friends in the circle can be sweet tooths as well, they just will not be able to take a candy even once.

In the fourth example, Lena is wrong and this situation couldn''t happen.

 

题目大意: 告诉你有 n 个人在圈里,共计有 k 个糖果,从起点出发到终点(可能经过好几圈),每个人只拿一个糖果或者两个糖果每次,爱吃甜食的小朋友可以拿两个一次(但是如果糖果不够了,也只能拿一个),问最多有多少个小朋友爱吃甜食。

n,k<=10^11

思路: 

n 和 k 都比较大,所以我们要分类讨论。

考虑到经过 t+1 次的那部分有 x 个人,经过 t 次的那部分有 y 个人。x=(r-l+n)% n+1;  x 里面有 a 个吃甜食,y 里面有 b 个吃甜食

如果 n 比较小,那么我们就暴力枚举 a 和 b 的值。

如果 n 比较大,此时 k/n 比较小,也就是圈数比较少,我们可以暴力枚举 t,然后解二元一次方程组。 

注意: 最后一个小朋友吃几个糖果要分类讨论(因为最后一个小朋友有可能喜欢吃甜食)。

 1 #include<bits/stdc++.h>
 2 using namespace std; 
 3 
 4 #define F(i,a,b) for(int i=a;i<=b;i++) 
 5 #define D(i,a,b) for(int i=a;i>=b;i--) 
 6 #define ms(i,a)  memset(a,i,sizeof(a)) 
 7 #define LL       long long 
 8 template<class T>void read(T &x){
 9     x=0; char c=getchar(); 
10     while (c<''0'' || c>''9'') c=getchar(); 
11     while (c>=''0'' && c<=''9'') x=(x<<3)+(x<<1)+(c^48),c=getchar();
12 }
13 template<class T>void write(T x){
14     if(x<0) x=-x,putchar(''-''); 
15     if(x>9) write(x/10); 
16     putchar(48+x%10);  
17 }
18 template<class T>void chkmax(T &x,T y){ x=x>y? x:y; }  
19 LL n,k,l,r,x,t,s,p,ans,y;  
20 LL const inf=1LL<<50;  
21 LL calc(LL p,LL s,int a,int b){
22     if(a==0 || b==1){
23         if(k-s-x>=0 && (k-s-x)%(n+p)==0)
24             return p;  
25         else return -1;  
26     }else {
27         if(k-s+1-x>=0 && (k-s+1-x)%(n+p)==0)
28             return p;  
29         else return -1;  
30     }
31 }
32 
33 LL exgcd(LL &x,LL &y,LL a,LL b){
34     if(!b){
35         x=1;y=0; return a; 
36     }
37     LL t=exgcd(y,x,b,a%b);  
38     y-=a/b*x; 
39     return t;  
40 }
41 void solve(LL t1,LL t2,LL c,LL add){
42     if(t2==0){
43         if(2*x>=k && k>=x) chkmax(ans,min(x,k-x+1)+y); 
44         return;
45     }
46     LL a,b;
47     LL g=exgcd(a,b,t1,t2); 
48     a=a*c; b=b*c; 
49     LL l=-inf,r=inf;  
50     a-=add; 
51     if (a>=0) r=min(r,a/t2); else  r=min(r,(a-t2+1)/t2); a+=add;  
52     if(a-x>=0) l=max(l,(a-x+t2-1)/t2); else l=max(l,(a-x)/t2);  
53     if(y-b>=0) r=min(r,(y-b)/t1); else r=min(r,(y-b-t1+1)/t1); 
54     if(-b>=0) l=max(l,(-b+t1-1)/t1); else l=max(l,-b/t1);  
55     if(l<=r){
56         chkmax(ans,a+b+l); 
57         chkmax(ans,a+b+r);  
58     }
59 }
60 int main(){
61     read(n); 
62     read(l); 
63     read(r); 
64     read(k); 
65     x=(r-l+n)% n+1;  
66     y=n-x;  
67     ans=-1;  
68     if(k/n>=5000000){
69         F(p,0,n) F(s,max(0LL,x-(n-p)),min((int)x,p)){
70             if(s<x) chkmax(ans,calc(p,s,0,0));  
71             if(s)chkmax(ans,calc(p,s,1,0));  
72             if(s)chkmax(ans,calc(p,s,1,1));  
73         }
74     }else {
75         F(t,0,k/n){
76             solve(t+1,t,k-t*x-x-t*y,0);  
77             solve(t+1,t,k-t*x-x-t*y+1,1);  
78         }
79     }
80     write(ans); 
81     return 0; 
82 }

 

关于CG软件调研 The Foundry旗下的HIEROcg软件是干什么的的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于3D CG软件blender入门教程、?Not Found The requested URL /www/index.php was not found on this server.解决办法、Basic overview of the country''s highest、cf 1063D Round 516 Candies for Children的相关信息,请在本站寻找。

本文标签: